I understand how to find the coefficients of a bivariate regression and univariate regression w/o an intercept, i.e:
Univariate: Y = BX + e
Bols =
= (X'X)^(-1) X'Y
= (X'X)^(-1) X'(BX + e)
= B + (X'X)^(-1) Xe If we take expectation/ e and X are independent
= B
Bivariate: Y = X1*C + X2*B + e
X1*M_X2*Y = X1*M_X2*X1*C + X1*M_X2*X2*B + X1*M_X2*e
X1*M_X2*Y = X1*M_X2*X1*C + X1*M_X2*e Assuming X and e are independent
C = (X1*M_X2*Y)* (X1*M_X2*X1*C)^(-1)
B = (X2*M_X1*Y)* (X2*M_X1*X2*C)^(-1)
But when there is an intercept I am pretty confused about what you are supposed to do when an intercept is included.
I started to do univariate and got:
Univariate: Y = a + Bx + e
Bols =
= (X'X)^(-1) X'Y
= (X'X)^(-1) X'(a + BX + e)
= (X'X)^(-1) X'(a) + B + (X'X)^(-1)X'e Take E, E[e|x] = 0
= (X'X)^(-1) X'(a) + B
Bols is a vector: [a B] [ E[X'X]^(-1) ]*E[X'] 1]'
But I am not sure if this is correct?
Or what should be done if it is bivariate: Y= a + Cx1 + Bx2 + e ?
Thanks!