Docsity

Multiple Linear Regression: Modeling and Analysis - Prof. Chong Gu, Study notes of Statistics

Toggle sidebar
bg1
STAT 512 Multiple Linear Regression 1
Slide 1
'
&
$
%
Multiple Regression Models: Examples
•Consider multiple predictors X1,X
2,...,X
p−1. A multiple linear
regression model is given by
Y=β0+β1X1+···+βp−1Xp−1+.
•For a single predictor X, a quadratic polynomial regression model is
given by
Y=β0+β1X+β2X2+.
•For two predictors X1and X2, a regression model with an
interaction term is given by
Y=β0+β1X1+β2X2+β3X1X2+,
and a quadratic response surface model is given by
Y=β0+β1X1+β2X2+β3X1X2+β4X2
1+β5X2
2+,
Slide 2
'
&
$
%
Multiple Regression Models: General
The examples above are all of the form
Y=β0+β1f1(X)+···+βp−1fp−1(X)+,
where fj(X)’s are known functions of the predictor(s) Xand βj’s
are to be estimated.
Alinear model is linear in the unknown coefficients βj’s.
Generally, a linear regression model to be estimated using
observations (Yi,X
i,1,...,X
i,p−1) can be written as
Yi=β0+β1Xi,1+···+βp−1Xi,p−1+i,
where Xi,j is the ith reading of the jth (numerical) predictor.
C. Gu Spring 2009
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Multiple Linear Regression: Modeling and Analysis - Prof. Chong Gu and more Study notes Statistics in PDF only on Docsity!

Slide 1

Multiple Regression Models: Examples

  • Consider multiple predictors X 1 , X 2 ,... , Xp− 1. A multiple linear regression model is given by Y = β 0 + β 1 X 1 + · · · + βp− 1 Xp− 1 + .
  • For a single predictor X, a quadratic polynomial regression model is given by Y = β 0 + β 1 X + β 2 X^2 + .
  • For two predictors X 1 and X 2 , a regression model with an interaction term is given by Y = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 1 X 2 + , and a quadratic response surface model is given by Y = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 1 X 2 + β 4 X 12 + β 5 X 22 + ,

Slide 2

Multiple Regression Models: General

The examples above are all of the form

Y = β 0 + β 1 f 1 (X) + · · · + βp− 1 fp− 1 (X) + ,

where fj (X)’s are known functions of the predictor(s) X and βj ’s

are to be estimated.

A linear model is linear in the unknown coefficients βj ’s.

Generally, a linear regression model to be estimated using

observations (Yi, Xi, 1 ,... , Xi,p− 1 ) can be written as

Yi = β 0 + β 1 Xi, 1 + · · · + βp− 1 Xi,p− 1 + i,

where Xi,j is the ith reading of the jth (numerical) predictor.

Slide 3

Linear Regression in Matrix Terms

Putting Yi = β 0 + β 1 Xi, 1 + · · · + βp− 1 Xi,p− 1 + i in matrix terms,

Y 1

Yn

1 X 1 , 1... X 1 ,p− 1 .. .

1 Xn, 1... Xn,p− 1

β 0 .. . βp− 1

n

or more concisely,

Y = Xβ + ,

where Y is n × 1, X is n × p, β is p × 1, and  is n × 1.

Under the model assumptions,

E{} = 0, E{Y} = Xβ,

σ^2 {Y} = σ^2 {} = σ^2 I.

Slide 4

LS Estimation, Fitted Values, Residuals

The LS criterion can be written as

Q = (Y − Xβ)′(Y − Xβ).

Taking derivatives w.r.t. β and set to 0, the LS estimates satisfy

(X′X)b = X′Y, or b = (X′X)−^1 (X′Y).

The fitted values are

Yˆ = Xb = X(X′X)−^1 X′Y = HY,

and the residuals are

e = Y − Yˆ = (I − H)Y.

The variance is estimated by MSE = SSE/(n − p), where

SSE = e′e = Y′(I − H)Y.

Slide 7

Inferences Concerning βj

The same as for SLR,

E{b} = β, σ^2 {b} = σ^2 (X′X)−^1 ,

where the latter is to be estimated by

s^2 {b} = MSE (X′X)−^1.

The inferences concerning βj are based on

bj − βj

s{bj }

∼ t(n − p).

For example, a (1 − α)100% CI for βj is

bj ± t 1 −α/ 2 ,n−ps{bj }.

Slide 8

Joint CI’s: Bonferroni Method

Suppose n = 23, p = 4, and b 1 = − 1. 21 , s{b 1 } =. 30 , b 2 = −. 67 , s{b 2 } =. 82 , b 3 = − 8. 61 , s{b 3 } = 12. 24. The joint “95%” CI’s for β 1 , β 2 , and β 3 by the Bonferroni method are given by β 1 ∈ − 1. 21 ± 2 .625(.30), β 2 ∈ −. 67 ± 2 .625(.82), β 3 ∈ − 8. 61 ± 2 .625(12.24), where t 1 −. 05 /2(3), 19 = 2.625.

To estimate several parameters jointly, one often wants the joint confidence coefficient to be above a certain level, say

P (βj ∈ bj ± Bs{bj }, j = 1, 2) ≥ 1 − α. The Bonferroni method uses B = t 1 −α/ 2 g,n−p, where g is the number of parame- ters involved in the estimation.

  • The actual conf. coef. is usually greater than the nominal 1 − α.

Slide 9

Inferences Concerning E{Yh|Xh} = X′ hβ

To estimate the mean response at Xh = (1, Xh, 1 ,... , Xh,p− 1 )′,

E{Yh|Xh} = β 0 + β 1 Xh, 1 + · · · + βp− 1 Xh,p− 1 = X′ hβ,

use the unbiased estimate

Yˆh = b 0 + b 1 Xh, 1 + · · · + bp− 1 Xh,p− 1 = X′ hb.

It can be shown that Yˆh ∼ N (X′ hβ, σ^2 { Yˆh}), where

σ^2 { Yˆh} = σ^2 X′ h(X′X)−^1 Xh.

Estimate σ^2 { Yˆh} by s^2 { Yˆh} = (MSE) X′ h(X′X)−^1 Xh, and as usual,

the inferences are based on

Yˆh − X′ hβ

s{ Yˆh}

∼ t(n − p).

Slide 10

Prediction of New Observation at Xh

To predict a new response at Xh,

Yh = β 0 + β 1 Xh, 1 + · · · + βp− 1 Xh,p− 1 +  = X′ hβ + ,

one has to allow for the variability of .

With X′ hβ estimated by X′ hb and σ^2 estimated by MSE, a

(1 − α)100% prediction interval is given by

Yˆh ± t 1 −α/ 2 ,n−p

MSE + s^2 { Yˆh},

or more explicitly,

Yˆh ± t 1 −α/ 2 ,n−p^ √MSE(1 + X′ h(X′X)−^1 Xh).

Slide 13

Tests Based on Extra SS

To test the hypotheses H 0 : βj = 0 vs. Ha : βj 6 = 0, one may calculate t∗^ = (^) s{bbj j }^

If |t∗| > t 1 −α/ 2 ,n−p, reject H 0. Using the general linear test, one calculates F ∗^ = (SSE(R)^ −^ SSE(F^ ))/^1 SSE(F )/(n − p)

If F ∗^ > F 1 −α, 1 ,n−p, reject H 0. Note that SSE(R) − SSE(F ) here is simply the type-III SS of Xj.

  • It can be shown that F ∗^ = (t∗)^2.

Consider the model Y = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 3 + , and test the hypotheses H 0 : β 2 = β 3 = 0 vs. Ha : o.w. Using the general linear test, one calculates F ∗^ = (^) SSE(SSR(X X^2 , X^3 |X^1 )/^2 1 , X 2 , X 3 )/(n^ −^ 4)

If F ∗^ > F 1 −α, 2 ,n− 4 , reject H 0. SSR(X 2 , X 3 |X 1 ) is simply the sum of the type-I SS of X 2 and X 3.

  • Put suspect terms at the end, and add type-I SS from bottom up.

Slide 14

Testing General Linear Hypotheses

When H 0 is not of the form βj = · · · = βk = 0, one has to modify

the data to perform the test using SAS.

Consider the model Y = β 0 + β 1 X 1 + β 2 X 2 + , and test the hypotheses H 0 : β 1 = β 2 vs. Ha : β 1 6 = β 2 Rewrite the model as Y = β 0 + β 1 (X 1 + X 2 )

  • (β 2 − β 1 )X 2 +  = β 0 + β 1 X∗ 1 + β 2 ∗ X 2 +  The hypotheses becomes H 0 : β∗ 2 = 0 vs. Ha : β 2 ∗ 6 = 0.

Consider the model Y = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 3 + , and test the hypotheses H 0 : β 1 = 3, β 3 = 5 vs. Ha : o.w. Rewrite the model as Y ∗^ = β 0 +β∗ 1 X 1 +β 2 X 2 +β∗ 3 X 3 +, where Y ∗^ = Y − 3 X 1 − 5 X 3 , β∗ 1 = β 1 − 3, and β 3 ∗ = β 3 − 5. The hypotheses becomes H 0 : β 1 ∗ = β 3 ∗ = 0 vs. Ha : o.w.

Slide 15

Coefficient of Partial Determination/Correlation

The coefficient of determination, R^2 = SSTOSSR , quantifies the

proportion of total variation explained by the model.

The coefficient of partial determination quantifies the

proportion of the residual variation in a “existing” model that is

explained by some extra predictor.

r Y^2 1. 2 =

SSR(X 1 |X 2 )

SSE(X 2 )

, r^2 Y 2. 13 =

SSR(X 2 |X 1 , X 3 )

SSE(X 1 , X 3 )

The coefficient of partial correlation measures the linear

association between Y and some Xj after “detrending” against a

set of common variables,

rY 2. 13 = r(Y − Yˆ (X 1 , X 3 ), X 2 − Xˆ 2 (X 1 , X 3 )).

Slide 16

Multicollinearity

Consider the model Y = β 0 + β 1 X 1 + β 2 X 2 + . If X 1 and X 2 are uncorrelated, then SSR(X 2 |X 1 ) ≈ SSR(X 2 ). If X 1 and X 2 are “perfectly” corre- lated, i.e., X 2 = aX 1 + b, then SSR(X 2 |X 1 ) = 0. Multicollinearity: The same in- formation is carried in more than one predictors. With multicollinearity, the regres- sion coefficients βj ’s are not as identifiable, so are not as estimable.

  • One can get good fit and reli- able inferences concerning the response within the data range.
  • Individual regression coeffi- cients are less estimable or in- terpretable.
  • Some coefficient estimate, say b 1 , may vary a lot when other terms are included/excluded; s{b 1 } then should be large in the “bigger” model.
  • One may see r^2 Y 1 >> r^2 Y 1. 2 , or SSR(X 1 ) >> SSR(X 1 |X 2 ).

Slide 19

Forward/Backward Regression

Forward regression

  1. Start with no variable in.
  2. With X^1 ,... , Xj−^1 in the model, search among the P −j still out and pick the largest SSR(Xk |X^1 ,... , Xj−^1 ). Call the variable Xj^.
  3. If Xj^ passes a F -test, add it to the model and go back to
    1. If it fails the test, stop.
  • The full model for the F -test is X^1 ,... , Xj−^1 , Xj^.

Backward regression

  1. Start with all P −1 variables in the model.
  2. Search among all variables still in the model and pick the smallest type-III SS. Call the variable X∗.
  3. If X∗^ fails the F -test, drop it from the model and go back to
    1. If it passes the test, stop.
  • The full model for the F -test keeps shrinking.

Slide 20

Stepwise Regression

Stepwise regression

  1. Start with no variable in the model.
  2. Add variables as in forward re- gression. After each addition, drop insignificant ones as in backward regression.
  3. When all that are in can’t be dropped, and all that are out can’t be added, stop.
  • The full model for the F -tests is constantly changing.
  • The F -tests are controlled by significance levels SLE and SLS; usually SLE ≥ SLS.
  • A k-variable model selected by stepwise regression may not be the “best” k-variable model.
  • There is no best model, and don’t leave the robot in charge. Use the techniques to narrow down choices, use subject-area knowledge to select. Make sure the selected model is in- terpretable.

Slide 21

Partial Regression Plots

Data of Prob. 6.15.

  • •

     - 
  • •
  • •
  • •
  • (^) •
  • •

e_1.

e_y.

-10 -5 0 5 10 15

10

  • ••
  • •
  • •
  • • •

e_2.

e_y.

-4 -2 0 2 4

0

10

Consider predictors X 1 , X 2 , and X 3. To assess the “net” effect of X 2 given X 1 , X 3 in the model, one may use the partial regression plot, which plots Y − Yˆ (X 1 , X 3 ) versus X 2 − Xˆ 2 (X 1 , X 3 ). Fitting a SLR to the partial regres- sion plot of X 2 , the intercept is 0 and the slope is b 2.

  • The effect shown is net of linear dependency on X 1 and X 3.
  • These plots may help in spotting problems, but rarely suggest fixes.

Slide 22

Studentized Deleted Residuals

To identify Y -outlyers, use the deleted residuals di = Yi − Yˆi(i), where Yˆi(i) is the prediction at Xi based on the other n − 1 observa- tions. It can be shown that di = ei 1 − hi,i , σ^2 {di} = σ

2 1 − hi,i

where hi,i is the ith diagonal of the hat matrix H = X(X′X)−^1 X′. Studentizing the di’s, one has ti = (^) s{ddi i}^ = √ ei MSE(i)(1 − hi,i)

where MSE(i) is based on the other n − 1 observations.

When all are well ti ∼ t(n − p − 1). One may compare maxi |ti| with t 1 −α/ 2 n,n−p− 1 to formally test for outlyers, but ti’s are more often used as informal diagnostics.

  • Note that there is no contribu- tion from Yi in Yˆi(i). The delete- one operation is closely related to jackknife and cross-validation.
  • One may calculate ti using

ti = ei

n − p − 1 SSE(1 − hi,i) − e^2 i^.

Slide 25

Cook’s Distance

To assess the influence of (Xi, Yi) on the overall fit, one calculates Di = ( Yˆ − Yˆ(i))′( Yˆ − Yˆ(i)) pMSE = (b − b(i))′(X′X)(b − b(i)) pMSE

Note that σ^2 {b} = σ^2 (X′X)−^1 , so Di is an aggregated version of (DFBETAS)j(i). As a rule of thumb, a Di in the range of. 8 ∼ 1 or above is really influential. In general, a Di sub- stantially greater than the rest of- ten indicates an influential case.

  • If an influential case is of high quality, it carries more infor- mation than the rest, yielding more precise estimates if the model is correct.
  • If an influential case is of doubtful quality, discard it.
  • One does not need to calcu- late n separate fits to obtain (DFFITS)i, (DFBETAS)j(i), and Cook’s Di. Using some algebraic identities, all can be calculated from the all-data fit.

Slide 26

Variance Inflation Factor

With two predictors X 1 and X 2 , (VIF) 1 = (VIF) 2 = (^1) −^1 r 2 12

where r 12 = r(X 1 , X 2 ), the cor- relation between X 1 and X 2. With more than two predictors, (VIF)j ≥ (^1) −^1 r 2 jk

, ∀k 6 = j, where rjk = r(Xj , Xk ). The pairwise correlations rjk are themselves diagnostics for mul- ticollinearity, but they can miss “hidden” patterns.

To assess multicollinearity among the predictors, one calculates the variance inflation factors, (VIF)j = (^1) −^1 R 2 j

where R^2 j is the R^2 of predicting Xj using the other predictors. As a rule of thumb, maxj (VIF)j ≥ 10 indicates serious multicollinearity problem. Note that (VIF)j ≥ 1.

  • Large (VIF)j ’s only come in groups.