In: Advanced Math
how to represent the following in a linear model y=Xb + e where b' = (u,a1,a2,a3,y1,y2,y3) and e'=(e11,e12,e13,e21,e22,e23,e31,e32,e33)
' means transpose
y11=u+a1+y1+e11
y12=u+a1+y2+e12
y13=u+a1+y3+e13
y21=u+a2+y1+e21
y22=u+a2+y2+e22
y23=u+a2+y3+e23
y31=u+a3+y1+e31
y32=u+a3+y2+e32
y33+u+a3+y3+e33
X is a matrix pattern but I am confused about 1 and 0 placement
Also can X'X and X'y be determined and written in normal equations
MATLAB Code:
close all
clear
clc
syms e11 e12 e13 e21 e22 e23 e31 e32 e33
syms u a1 a2 a3 y1 y2 y3
assume(e11, 'real'); assume(e12, 'real'); assume(e13,
'real');
assume(e21, 'real'); assume(e22, 'real'); assume(e23,
'real');
assume(e31, 'real'); assume(e32, 'real'); assume(e33,
'real');
assume(u, 'real'); assume(a1, 'real'); assume(a2, 'real');
assume(a3, 'real');
assume(y1, 'real'); assume(y2, 'real'); assume(y3, 'real');
X = [1 1 0 0 1 0 0;
1 1 0 0 0 1 0;
1 1 0 0 0 0 1;
1 0 1 0 1 0 0;
1 0 1 0 0 1 0;
1 0 1 0 0 0 1;
1 0 0 1 1 0 0;
1 0 0 1 0 1 0;
1 0 0 1 0 0 1]
b = [u a1 a2 a3 y1 y2 y3]'
e = [e11 e12 e13 e21 e22 e23 e31 e32 e33]'
y = X*b + e;
disp('Hence, y = X*b + e ='), disp(y)
disp('X''X ='), disp(X'*X)
disp('X''y ='), disp(X'*y)
Output: