202405181945
Status: #idea
Tags: Multiple Linear Regression

The Method Of Least Squares in Multiple Linear Regression

Pasted image 20240606151018.png

The logic is identical to the Simple Linear Regression case, except that we now need to represent everything in matrix form.

This changes the formulas since now we need to find our estimators using tensor calculus and stuff, but if you understand the logic in the single-variate case, doing it for multiple variables is just deriving the formulas using matrices all over again.

I will not bother going through the derivation mainly because I got a textbook that does it already, so I will just paste the formulas.

The Importance of SSres(∑i=1nei)

Pretty much all the formulas below are derived through some representation of the sum of error which we're trying to minimize. It is good to familiarize oneself with the ways to do so.

Formulas

β^=

Pasted image 20240518200034.png

SSres=SSError=∑i=inei2=∑i=in(Yi−Y^i)2= Pasted image 20240518195411.png

From the equation for β^ and SSres we can simplify the equation for SSres to
Pasted image 20240518201001.png

The degree of freedoms of SSres in the multiple linear regression case is n−k where k is the number of parameters. This is nothing more than a generalization of the Simple Linear Regression which had n−2 degree of freedoms since we needed 2 error terms to be fixed to satisfy the normal equations.

Therefore we can compute the MSres as
Pasted image 20240518201404.png
The image above tells us that SSres is distributed according to a χ2 with n−k degrees of freedom.

SStotal=∑i=1n(Yi−Y¯)2=

Pasted image 20240518201936.png
First SST has n−1 degree of freedoms.

In matrix form this is written as:

SST=YTY−nY¯2

Where Y¯ is a scalar quantity.

Since we have a formula for SSres and a formula for SST through the relation SST=SSres+SSreg we can derive that:

SSreg=∑i=1n(Y^i−Y¯)2=

Pasted image 20240518202222.png

SSreg has how many degree of freedoms?

Recall that DFtotal=DFreg+DFres, since we know that DFtotal is n−1 and that DFres is n−k where k is the number of parameters, it follows that n−1−(n−k) or in a civilized world k−1 will be the number of degrees of freedom of SSreg.

Therefore MSreg is:

MSreg=SSregk−1

The Method Of Least Squares In Simple Linear Regression
Video on Multiple Linear Regression