202405181928
Status: #idea
Tags: Regression Analysis

Multiple Linear Regression

This is what we do when we have more than one regressor variables, more than one independent variables.
So

yi=β0+β1xi,1+β2xi,2+βnxi,k

This is a linear relationship with k independent variables.

Technically you could do The Method Of Least Squares by hand and do differentiation for 2 regressor, 3 regressors, etc.

But that'd be dumb, painful and slow. So instead we generalize it by writing everything in matrix form.

Assumptions

ϵi is distributed according to N(0,σ2)

Notation

The above format while clear, is unwieldy and long.
We can instead write everything as matrices and store all of that same information in matrix format.

Y=(y1,y2,,yk)Tβ=(β0,β1,β2,,βk)Tε=(ε1,ε2,,εk)TX=(1x11x12xik1x21x221xn1xn2xnk), this is a n ×k+1 matrix.

With all of those matrices defined I can write the regression for an arbitrary number of regressors:

Y=Xβ+ε

The Method Of Least Squares

Hypothesis Testing in Multiple Linear Regression

Covariance

We define the covariance of some vector Y as:

Cov(V)=E[(YE(Y))(YE(Y))T]:=Σ 

The above is often referred to as the variance-covariance matrix, because while it computes the covariance, since the covariance of a variable with itself is equal to it's variance, this matrix will contain the variance at diagonal entries, and the covariance at non-diagonal entries, hence variance-covariance. Note that this is a symmetric matrix.

From there it follows that:

Cov(AY)=AΣAT

Multivariate Normal

We already know that in the univariate case, a random variable X is said to be normally distributed if it's pdf is :

fX=1σ2πexp((xμ)2σ2)

Therefore by analogy, we can easily define a pdf for a normal that would be distributed according to multiple variables as follows:

fmultivariateX=Σ12(2π)n2exp(12(Xμ)TΣ(Xμ))

Where:

We say that such a random variable is:

YNn(μ,Σ)

Relevant Theorem

Pasted image 20240606145958.png

This is directly analogous to how in the univariate case, the linear combination of normally distributed random variables is a normally distributed variable.

Special Cases:

Hypothesis Testing

Checking for Significance of Regression

It checks if there's a linear relationship between the response variable and any of the Xi. it is often referred to as the Global Test of Model Adequacy.

Test on Significance of Model (Crucial to know, but in general we know that our model is significant.)

Checking for Significance of Specific Parameters

Typically we know that the model is significant, simply from looking at the data. Or at least we're pretty sure of it. While it's typically a slam dunk, we still want to show it for completeness and safety.

But the issue is that the previous test only tells us that some βi is not 0, it does not tell us anything about which specifically it is. Therefore, we're going to want to check individual parameters.

It is not scary, it's pretty much the same thing as the Simple Linear Regression case. We know that Y is distributed according to a Multivariate Normal. Since Y is nothing more than a linear combination of the βi's it follows that they are all distributed according to a N(μ,σ2), so by standardizing we get N(0,1) and then we take a test.

Except we don't really ever have σ2 so instead we use the MSE and have to use a tdistribution with the suitable degrees of freedom.
Test On Individual Regression Coefficient (Assuming We know our Model Is Significant)

Confidence Intervals

Confidence Interval for Individual Coefficients

Are you able to do an hypothesis for individual coefficients? Adjusted Coefficient of Determination

If so, your confidence interval is nothing more than:

βi±tα2;npMSE[XTX]iiorβi±tα2;npΣ^ii

As is a theme in stats, since we do not know σ2 we have to use estimates instead.
Recall that here, Σ is the variance-covariance matrix of β

Confidence Interval for Mean Response

Future me, you have a brain. So read this, and remember what it means. I ain't typing allat.
Pasted image 20240606165238.png
Pasted image 20240606165215.png

Confidence Interval for Prediction of New Observations

As usual our estimate is Y0=X0Tβ^
Then the confidence interval is simply:
Pasted image 20240606173027.png

Very much like the univariate case.

Simultaneous Confidence Interval (Joint CI)

Pasted image 20240606175011.png
Where p is the number of parameters for which we want a confidence interval.
Pasted image 20240606175143.png
We get the standard deviations for each βj from the variance-covariance matrix of β

Simple Linear Regression