simple linear regression iv lecture 4

22
Simple Linear Regression IV Analysis of Variance (ANOVA) Approach to Regression Correlation and Coef๏ฌcient of Determination Residual Analysis: Model Diagnostics and Remedies 4.1 Lecture 4 Simple Linear Regression IV Reading: Chapter 11 STAT 8020 Statistical Methods II September 1, 2020 Whitney Huang Clemson University

Upload: others

Post on 04-May-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.1

Lecture 4Simple Linear Regression IVReading: Chapter 11

STAT 8020 Statistical Methods IISeptember 1, 2020

Whitney HuangClemson University

Page 2: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.2

Agenda

1 Analysis of Variance (ANOVA) Approach to Regression

2 Correlation and Coefficient of Determination

3 Residual Analysis: Model Diagnostics and Remedies

Page 3: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.3

ANOVA Approach toLinear Regression

Page 4: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.4

Analysis of Variance (ANOVA) Approach to Regression

Partitioning Sums of SquaresTotal sums of squares in response

SST =

nโˆ‘i=1

(Yi โˆ’ Y)2

We can rewrite SST asnโˆ‘

i=1

(Yi โˆ’ Y)2 =

nโˆ‘i=1

(Yi โˆ’ Yi + Yi โˆ’ Y)2

=

nโˆ‘i=1

(Yi โˆ’ Yi)2

๏ธธ ๏ธท๏ธท ๏ธธError

+

nโˆ‘i=1

(Yi โˆ’ Y)2

๏ธธ ๏ธท๏ธท ๏ธธModel

Page 5: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.5

Partitioning Total Sums of Squares

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

20 30 40 50 60 70

160

170

180

190

200

Age

Max

Hea

rtR

ate

Page 6: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.6

Total Sum of Squares: SST

If we ignored the predictor X, the Y would be the best(linear unbiased) predictor

Yi = ฮฒ0 + ฮตi (1)

SST is the sum of squared deviations for this predictor(i.e., Y)

The total mean square is SST/(nโˆ’ 1) and represents anunbiased estimate of ฯƒ2 under the model (1).

Page 7: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.7

Regression Sum of Squares: SSR

SSR:โˆ‘n

i=1(Yi โˆ’ Y)2

Degrees of freedom is 1 due to the inclusion of the slope,i.e.,

Yi = ฮฒ0 + ฮฒ1Xi + ฮตi (2)

โ€œLargeโ€ MSR = SSR/1 suggests a linear trend, because

E[MSE] = ฯƒ2 + ฮฒ21

nโˆ‘i=1

(Xi โˆ’ X)2

Page 8: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.8

Error Sum of Squares: SSE

SSE is simply the sum of squared residuals

SSE =

nโˆ‘i=1

(Yi โˆ’ Yi)2

Degrees of freedom is nโˆ’ 2 (Why?)

SSE large when |residuals| are โ€œlarge"โ‡’ Yiโ€™s varysubstantially around fitted regression line

MSE = SSE/(nโˆ’ 2) and represents an unbiased estimateof ฯƒ2 when taking X into account

Page 9: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.9

ANOVA Table and F test

Source df SS MSModel 1 SSR =

โˆ‘ni=1(Yi โˆ’ Y)2 MSR = SSR/1

Error nโˆ’ 2 SSE =โˆ‘n

i=1(Yi โˆ’ Yi)2 MSE = SSE/(n-2)

Total nโˆ’ 1 SST =โˆ‘n

i=1(Yi โˆ’ Y)2

Goal: To test H0 : ฮฒ1 = 0

Test statistics Fโˆ— = MSRMSE

If ฮฒ1 = 0 then Fโˆ— should be near oneโ‡’ reject H0 when Fโˆ—

โ€œlarge"

We need sampling distribution of Fโˆ— under H0 โ‡’ F1,nโˆ’2,where F(d1, d2) denotes a F distribution with degrees offreedom d1 and d2

Page 10: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.10

F Test: H0 : ฮฒ1 = 0 vs. Ha : ฮฒ1 6= 0

0 50 100 150

0.0

0.2

0.4

0.6

0.8

1.0

1.2

Null distribution of F test statistic

Test statistic

Den

sity

Page 11: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.11

SLR: F-Test vs. T-test

ANOVA Table and F-Test

Parameter Estimation and T-Test

Page 12: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.12

Correlation andCoefficient ofDetermination

Page 13: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.13

Correlation and Simple Linear Regression

Pearson Correlation: r =โˆ‘n

i=1(Xiโˆ’X)(Yiโˆ’Y)โˆšโˆ‘ni=1(Xiโˆ’X)2

โˆ‘ni=1(Yiโˆ’Y)2

โˆ’1 โ‰ค r โ‰ค 1 measures the strength of the linearrelationship between Y and X

We can show

r = ฮฒ1

โˆšโˆ‘ni=1(Xi โˆ’ X)2โˆ‘ni=1(Yi โˆ’ Y)2 ,

this impliesฮฒ1 = 0 in SLR โ‡” ฯ = 0

Page 14: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.14

Coefficient of Determination R2

Defined as the proportion of total variation explained bySLR

R2 =

โˆ‘ni=1(Yi โˆ’ Y)2โˆ‘ni=1(Yi โˆ’ Y)2 =

SSRSST

= 1โˆ’ SSESST

We can show r2 = R2:

r2 =

(ฮฒ1,LS

โˆšโˆ‘ni=1(Xi โˆ’ X)2โˆ‘ni=1(Yi โˆ’ Y)2

)2

=ฮฒ2

1,LSโˆ‘n

i=1(Xi โˆ’ X)2โˆ‘ni=1(Yi โˆ’ Y)2

=SSRSST

= R2

Page 15: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.15

Maximum Heart Rate vs. Age: r and R2

Interpretation:

There is a strong negative linear relationship betweenMaxHeartRate and Age. Furthermore, โˆผ 91% of thevariation in MaxHeartRate can be explained by Age.

Page 16: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.16

Residual Analysis:Model Diagnostics and

Remedies

Page 17: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.17

Residuals

The residuals are the differences between the observedand fitted values:

ei = Yi โˆ’ Yi,

where Yi = ฮฒ0 + ฮฒ1Xi

ei is NOT the error term ฮตi = Yi โˆ’ E[Yi]

Residuals are very useful in assessing theappropriateness of the assumptions on ฮตi. Recall

E[ฮตi] = 0

Var[ฮตi] = ฯƒ2

Cov[ฮตi, ฮตj] = 0, i 6= j

Page 18: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.18

Maximum Heart Rate vs. Age Residual Plot: ฮต vs. X

โ—

โ—

โ—

โ— โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

20 30 40 50 60 70

โˆ’10

โˆ’5

0

5

10

Age

Res

idua

ls

Page 19: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.19

Interpreting Residual Plots

Figure: Figure courtesy of Farawayโ€™s Linear Models with R (2005, p.59).

Page 20: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.20

Model Diagnostics and Remedies

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

1 2 3 4

โˆ’40

โˆ’20

0

20

40

60

x

Res

idua

ls

โ‡’ Nonlinear relationship

Transform X

Nonlinear regression

โ—โ—

โ— โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

1 2 3 4

โˆ’4

โˆ’2

0

2

4

6

x

Res

idua

ls

โ‡’ Non-constant variance

Transform Y

Weighted least squares

Page 21: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.21

Extrapolation in SLR

โ—โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—โ—โ—

โ—โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—โ—

โ—โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—โ—โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—โ—

โ—

โ—โ—

โ—โ—โ—

โ—

โ—โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—โ—

โ—โ—

โ—

โ—

โ—โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—โ—

โ—โ—

โ—โ—

โ—

โ—โ—โ—โ—

โ—โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—โ—โ—โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—โ—

โ—

โ—

โ—โ—โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—โ—

โ—โ—โ—

โ—โ—โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—โ—

โ—

โ—โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—โ—โ—

โ—โ—

โ—

โ—โ—

โ—

โ—โ—

โ—

โ—โ—โ—

โ—โ—โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—โ—

โ—

โ—โ—

โ—

โ—โ—

โ—

โ—โ—โ—โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—

โ—โ—

โ—

โˆ’4 โˆ’2 0 2 4

โˆ’0.5

0.0

0.5

1.0

1.5

x

y

TrueSLR Fit

Extrapolation beyond the range of the given data canlead to seriously biased estimates if the assumed re-lationship does not hold the region of extrapolation

Page 22: Simple Linear Regression IV Lecture 4

Simple LinearRegression IV

Analysis of Variance(ANOVA) Approach toRegression

Correlation andCoefficient ofDetermination

Residual Analysis:Model Diagnostics andRemedies

4.22

Summary of SLR

Model: Yi = ฮฒ0 + ฮฒ1Xi + ฮตi

Estimation: Use the method of least squares to estimatethe parameters

Inference

Hypothesis Testing

Confidence/prediction Intervals

ANOVA

Model Diagnostics and Remedies