STAT 211 Topic 10

From Notes
Jump to navigation Jump to search

« previous | Thursday, April 14, 2011 | next »


Simple Linear Regression

Predicting linear relationships between two variables X and Y: Y=A+BX, where rvs A,BNormal.

Goal: Find the line such that the squared distance (so distance values are positive) between the predicted and observed values is minimized.

What the line tells us:

  • Estimates/Predicts values (interpolation within range; extrapolation outside of range)
  • Describe ratio between two variables (slope)
y=β0+β1x+ϵ
Regression Model Equation
  • β0, β1, and x are assumed to be unknown fixed parameters.
  • ε Error variable: ϵNormal(0,σ2)2 is unknown)
  • Therefore yNormal(β0+β1x, σ2)

We have estimates for x (sample data), but we need estimates for β0 and β1.


Least Squares

Given points (x1,y1),(x2,y2),,(xn,yn), our regression model is:

yi=β0+β1xi+ϵi

Squared distance between points is given by (yi(β0+β1xi))2. Therefore the sum of squared differences is:

S(β0,β1)=i=1n(yiβ0β1xi)2

Find β0 and β1 such that S(β0,β1) is minimized. (Take derivative, equate to zero, and solve)


Estimated Solutions: (both have normal distribution regardless of sample size)

β^0=(xix¯)(yiy¯)(xix¯)2N(β0, )β^1=y¯β^1x¯N(β1, σ2(xix¯)2)

Therefore, the final equation becomes

y^i=β^0+β^1xi

The fitted (predicted) value of yi is y^i=β^0+β^1xi


Residual (observed − fitted; yiy^i) can be plotted to check how well the line fits.


All computer stat systems will return a coefficient of determination R2 value. This value is always between 0 and 1, and R2 close to 1 implies a better fitting line.


Tests for β1

Since we don't know σ, we can substitute an estimate sϵ (see below), then the standard deviation of β1 is a T-distribution with df n2.

Therefore, we can do confidence intervals (β^1±tα/2sβ^1) and t-test for H0: β1 = β10 (t=β^1β10sβ^1)


Estimating σ2

Minimum value for D is the Error Sum of Squares:

D=i=0n(yi(β^0+β^1xi))2=SSE

To obtain estimate for σ2, we divide SSE by the (remaining) degrees of freedom (after estimating β1 and β2) n2:

sϵ=σ^=SSEn2

ANOVA for Regression

SST=SSR+SSE=i=1n(yiy¯)2Total Sum of SquaresSSE=i=1n(yi(β^0+β^1xi))2Error Sum of SquaresSSR=SSTSSE=i=1n(y^iy¯)2Regression Sum of SquaresR2=SSRSSTCoefficient of Determination

Source Sum of Squares Degrees of Freedom Mean Square f statistic
Regression Error SSR 1 MSR MSR / MSE
Error SSE n2 MSE
Total SST n1


Predicting with Regression

Suppose we have a new value that we want to estimate: x*

2 possible ways to calculate this:

  1. mean response (only think of value of regression model line): E(y|x=x*)=β^0+β^1x*
  2. prediction (include error variable ε): y^=β^0+β^1x*

Basically plugging in a new x value into the model equation to obtain a y^ estimate.

Mean Response

We want to narrow the range and reduce variance by as much as possible, so we disregard the variance of ε.

Calculate 100(1-α)% confidence interval for response with:

β^0+β^1x*±tα/2,n2sϵ1n+(x*x¯)2(xix¯)2

Prediction

Because the regression model has the ε term, the prediction is actually within a range.

β^0+β^1x*±tα/2,n2sϵ1+1n+(x*x¯)2(xix¯)2

Correlation Coefficient

Show how strongly related two random variables are.

Note: If X and Y are independent, then correlation is 0
Corr(X,Y)=ρX,Y=Cov(X,Y)V(X)V(Y)

where Covariance is

Cov(X,Y)=E(XY)E(X)E(Y)


For a population where we do not know the pdf (ƒ(x, y)), we can estimate the sample correlation coefficient using

r=i=1n(xix¯)(yiy¯)i=1n(xix¯)2i=1n(yiy¯)2