How Do You Derive the Least Squares Solution in Linear Regression?

tennishaha
Messages
21
Reaction score
0
In the least square linear regression, say we have y=Xb+e (y,b,e are vector and X is matrix, y is observations, b is coefficient, e is error term)
so we need to minimize e'e=(y-Xb)'(y-Xb)=y'y-y'Xb-b'X'y+b'X'Xb we can take the derivative of e'e to b, and we can get the answer is 0-2X'y+2X'Xb

but I don't know how to get the answer? (I don't know how to take derivative regarding a vector)

Can anyone help? Thanks
 
on Phys.org
write it out as a sum:
[tex]y=x'Ax = \sum_i \sum_j x_iA_{ij}x_j[/tex]
[tex]\frac{\partial y}{\partial x_k} = \sum_i\sum_j(\left x_iA_{ij}\delta_{jk} + \delta_{ik}A_{ij}x_j \right)[/tex]
if A is symmetric:
[tex]\frac{\partial y}{\partial x} = 2Ax[/tex]
this works only if A is symmetric though, otherwise it would be:
[tex]\frac{\partial y}{\partial x} = (A+A')x[/tex] i think...
you should take notice that demanding [tex]\frac{\partial y}{\partial x}=0[/tex] is actually trying to solve a system of linear equations since the derivative is defined to be a vector in this case.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 5 ·
Replies
5
Views
674
Replies
3
Views
3K
  • · Replies 23 ·
Replies
23
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 64 ·
3
Replies
64
Views
6K