Docsity

Simple Linear Regression - Formula and Theory - Fall 2008 | STAT 430, Study notes of Statistics

Toggle sidebar
bg1
Eric Slud, Stat 430 Fall 2008
Simple Linear Regression — Formulas & Theory
The purpose of this handout is to serve as a reference for some stan-
dard theoretical material in simple linear regression. As a text reference,
you should consult either the Simple Linear Regression chapter of your Stat
400/401 (eg the currently used book of Devore) or other calculus-based statis-
tics textbook (e.g., anything titled ‘Engineering Statistics’), or a standard
book on Linear Regression like
Draper, N. and Smith, H. (1981) Applied Linear Regression,
2nd edition. John Wiley: New York.
The model is
Yi=a0+b0Xi+i,1≤i≤n, iiid
∼N(0,σ2) (1)
where the constant real parameters (a0,b
0,σ2
0) are unknown. The pa-
rameters (a, b) are estimated by maximum likelihood, which in the case
of normally distributed iid errors as assumed here is equivalent to choos-
ing a, b in terms of {(Xi,Y
i)}n
i=1 by least squares, i.e. to minimize
Pn
i=1 (Yi−a−bXi)2, which results in:
ˆ
b=s.cov(X,Y)
s.var(X)=sXY
s2
X
,ˆa=¯
Y−ˆ
b¯
X(2)
where
¯
X=1
n
n
X
i=1
Xi,¯
Y=1
n
n
X
i=1
Yi,s
2
X=1
n−1
n
X
i=1
(Xi−¯
X)2
and
s2
Y=1
n−1
n
X
i=1
(Yi−¯
Y)2,s
XY =1
n−1
n
X
i=1
(Yi−¯
Y)(Xi−¯
X)
The predictors and residuals for the observed responses Yiare given
respectively by
Predictori=ˆ
Yi=ˆa+ˆ
bXi,Residuali=ˆi=Yi−ˆ
Yi
1
pf3
pf4
pf5

Partial preview of the text

Download Simple Linear Regression - Formula and Theory - Fall 2008 | STAT 430 and more Study notes Statistics in PDF only on Docsity!

Eric Slud, Stat 430 Fall 2008

Simple Linear Regression — Formulas & Theory

The purpose of this handout is to serve as a reference for some stan-

dard theoretical material in simple linear regression. As a text reference,

you should consult either the Simple Linear Regression chapter of your Stat

400/401 (eg the currently used book of Devore) or other calculus-based statis-

tics textbook (e.g., anything titled ‘Engineering Statistics’), or a standard

book on Linear Regression like

Draper, N. and Smith, H. (1981) Applied Linear Regression,

2nd edition. John Wiley: New York.

The model is

Yi = a 0 + b 0 Xi + i, 1 ≤ i ≤ n, i

iid

∼ N (0, σ

2

) (1)

where the constant real parameters (a 0

, b 0

, σ

2

0

) are unknown. The pa-

rameters (a, b) are estimated by maximum likelihood, which in the case

of normally distributed iid errors as assumed here is equivalent to choos-

ing a, b in terms of {(X i

, Y

i

n

i=

by least squares, i.e. to minimize

∑ n

i=

(Yi − a − bXi)

2

, which results in:

b =

s.cov(X, Y )

s.var(X)

s XY

s

2

X

, ˆa =

Y −

b

X (2)

where

X =

n

n ∑

i=

X

i

Y =

n

n ∑

i=

Y

i

, s

2

X

n − 1

n ∑

i=

(X

i

X)

2

and

s

2

Y

n − 1

n ∑

i=

(Y

i

Y )

2 , s XY

n − 1

n ∑

i=

(Y

i

Y )(X

i

X)

The predictors and residuals for the observed responses Y i

are given

respectively by

Predictor i

Y

i

= ˆa +

bX i

, Residual i

i

= Y

i

Y

i

The standard (unbiased) estimator of σ

2

is the Mean Residual Sum of

Squares (per degree of freedom) given by

σˆ

2

= MRSS =

n − 2

n ∑

i=

(Yi −

Yi)

2

Confidence intervals for estimated parameters are all based on the fact

that the least squares estimates ˆa,

b and the corresponding predictors of (the

mean of) Yi are linear combinations of the independent normally distributed

variables  j

, j = 1,... , n, and the general formula for any sequence of

constants u j

, j = 1,... , n,

n ∑

j=

u j

j

∼ N (0 , σ

2

n ∑

j=

u

2

j

We use this formula below with various choices for the vector u = {uj }

n

j=

Under the model (1), with true parameters (a 0

, b 0

, σ

2

0

), we first calculate

from (2) that

b − b 0

∑ n

j=

{Y

j

Y − b 0

(X

j

X)}(X

j

X)

∑ n

j=

(X

j

X)

2

(n − 1) s

2

X

n ∑

j=

j

  • a 0

  • b 0

X −

Y )(X

j

X) =

n ∑

j=

c j

j

(since

∑ n

j=

(X

j

X) = 0), where

c j

X

j

X

(n − 1)s

2

X

with sum of squares

∑ n

j=

(Xj −

X)

2

(n − 1)

2 s

4

X

(n − 1)s

2

X

Therefore, by (3), we have

b − b 0

n ∑

j=

X

j

X

(n − 1) s

2

X

j

∼ N

(

σ

2

(n − 1)s

2

X

)

Next, using

aˆ − a 0 =

Y −

b

X − a 0 =

n

n ∑

j=

(j − (

b − b 0 )

X) =

n ∑

j=

uj j

Continuing with the formula (8) for SSE, we find via (4) that with uj = cj =

(X

j

X)/((n − 1)s

2

X

SSE =

n ∑

j=

(j − ¯ − (

b − b 0 )(Xj −

X))

2

n ∑

j=

(

j

− ¯ − (X

j

X)

n ∑

k=

X

k

X

(n − 1)s

2

X

k

) 2

n ∑

j=

j

2

−

(n − 1) s

2

X

( n ∑

j=

j

(X

j

X)

) 2

= e

′

(

I −

n

′

− (n − 1)s

2

X

cc

′

)

e (9)

where ¯ = n

− 1

∑ n

j=

j and e denotes the n-vector with components j.

Since the (jointly) normally distributed variables c

′ e and ¯ = 1

′ e/n and

the components of (I −

1

n

′ − (n − 1)s

2

X

cc

′ )e are uncorrelated, they are

actually independent, and the quadratic form (9) can be proved to have the

property

SSE

σ

2

0

= (n − 2)

σˆ

2

σ

2

0

∼ χ

2

n− 2

An important aspect of this proof is the observation that the matrix

M = I −

1

n

′

− (n−1)s

2

X

cc

′

is a projection matrix, that is, is symmetric

and idempotent, which means that M

2 = M, and the quadratic form (9) is

equal to (Me)

′ (Me). The independence of (ˆa,

b) and Me is confirmed

by checking that the covariances are 0:

Cov(Me, 1

′

e) = σ

2

0

M1 = 0 , Cov(Me, c

′

e) = σ

2

0

Mc = 0

The independence of (ˆa,

b) and ˆσ

2

then immediately implies, by definition

of the t-distribution, that

b − b 0

n − 1

s X

σ ˆ

∼ t n− 2

ˆa − a 0

σ ˆ

{ 1

n

X

2

(n − 1) s

2

X

} − 1 / 2

∼ t n− 2

Finally, we turn to the definitions of confidence intervals and the CLM

and CLI confidence and prediction intervals constructed and plotted by SAS.

The main ingredient needed in the justification of these is the result (11)

just proved. The confidence and prediction intervals say that each of the

following statements has probability 1 − α under the model (1):

b 0

b ± t n− 2 ,α/ 2

σ ˆ

s X

n − 1

a 0

∈ aˆ ± t n− 2 ,α/ 2

σˆ

( 1

n

(n − 1)s

2

X

) 1 / 2

a 0

  • b 0

X

0

∈ aˆ +

bX 0

± t n− 2 ,α/ 2

σˆ

( 1

n

(X

0

X)

2

(n − 1)s

2

X

) 1 / 2

Y

i

∈ aˆ +

bX i

± t n− 2 ,α/ 2

σˆ

(

n

(X

i

X)

2

(n − 1)s

2

X

) 1 / 2

The confidence intervals (12) and (13) are exactly as used by SAS in

determining p-values for the significance of coefficients a, b (in testing the

respective null hyptheses that b = 0 or that a = 0.) The interval (14) is

what SAS calculates in generating the CLM upper and lower confidence limits

that it calculates and plots at location X i

either within PROC GPLOT or PROC

REG. The interval (15) is only a retrospective prediction interval within which

we should have found Yi with respect to its predictor

Yi but it is NOT what

SAS calculates in generating the CLI upper and lower individual-observation

prediction limits at location Xi either within PROC GPLOT or PROC REG.

Prediction intervals are meant to capture not the observations

already seen but rather any new observations Y

′

i

which would be

collected at the previous locations X i

or at brand-new locations

X

0

. So we discuss next the corrected formula for prediction

interval which SAS actually calculates.

We are interested sometimes, especially as part of diagnostic checking

and model-building, in making prediction intervals for values Y 0

(not yet

observed) corresponding to values X 0

which were not in fact part of the

dataset. The thing to understand is that formula (15) is not applicable to

this situation because it refers to observations Y i

which were already used

as part of the model-fitting that resulted in ˆa,

b. If Y 0

= a 0

  • b 0

X

0

0

with a 0

, b 0

the same as before but with  0

∼ N (0, σ

2

0

) independent of all