1. Simple Linear Regression

3 Dataset: (x1,y1),(xn,yn)
x= predictor variable (assumed to be constant)
(only one if simple linear regression otherwise a vector for multiple linear regression)

y= response variable (assumed to be random/stochastic)

Assumption: response variables are normally distributed (conditioned on the predictor), variance is equal across all predictors.

The data values Y come from different conditional distributions for each xX:

Y|X=xp(y|x)

Goal: Find the line that best fits our data

y^i=β^0+β^1xiYi|X=yiN(β0+β1xi,σ2)

Carry out a hypothesis test:

H0:β1=0Ha:β10

If reject H0 construct C.I for E(y) at x=x , also want to predict future observation (y) when x=x

When p(yx) is...Then you have...NormalClassical regressionPoissonPoisson regressionNegative binomialNegative binomial regressionBernoulliLogistic regressionBetaBeta regressionLognormalLognormal regression

Main Assumptions

Randomness (wrt Y)
Correct Functional Specification (linear, polynomial, etc.)
L: Expected value is given by a linear function
Uncorrelated Errors
I: Independent
N: Normally Distributed
E: Equal variance
Constant variance (Y|X)
Normality

yi=β0+β1xi+εiεiiidN(0,σ2)

(homoscedasticity)

Pasted image 20250505132418.webp|433

Pasted image 20250505132454.webp|434


Least Squares Point Estimates

E(Y)=β0+β1x

Wants to fit a line to (x1,y1),,(xn,yn)

minβ0,β1Q=i=1n[yi(β0+β1xi)]2

Where Q is the sum of squares for error, SSE

Qβ0=i=1n2[yi(β0+β1xi)]Qβ=i=1n2xi[yi(β0+β1xi]

For β^0

0=(yiβ0β1xi)(1)=yinβ0nβ1x¯=ny¯nβ0nβ1x¯*β0=y¯β1x¯

For β^1
Note: Identity (xix¯)2=xi2nx¯2

SXY=(xix¯)(yiy¯)=xiyinx¯y¯SXX=(xix¯)2=(n1)sx20=xi(yiβ0β1xi)(2)=xiyiβ0xiβ1xi2=xiyi(y¯β1x¯)nx¯β1xi2=xiyiy¯nx¯+β1nx¯2β1xi2=xiyiy¯nx¯+β1(nx¯2xi2)β1(xi2nx¯2)=xiyiny¯x¯β1((xix¯)2)=(xix¯)(yiy¯)*β1=SXYSXX

Normal Equations:

(1)nβ0+β1xi=yi(2)β0xi+β1xi2=xiyi

Using Cramer's Rule:

β0=Δβ0Δ=det[yixixiyixi2]det[nxixixi2]=yixi2(xixiyi)nxi2[xi]2β1=Δβ1Δ=det[nyixixiyi]nxi2[xi]2

These are also the MLE

Correlation Coefficient

r=sxysxsy=1n1i=1n(xix¯)(yiy¯)1n1i=1n(xix¯)21n1i=1n(yiy¯)2=i=1nxiyinx¯y¯(i=1nxi2nx¯2)(i=1nyi2ny¯2)

=Cov(x,y)sxsy

=β^1SxxSyy