simple linear regression iv lecture 4
TRANSCRIPT
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
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
Simple LinearRegression IV
Analysis of Variance(ANOVA) Approach toRegression
Correlation andCoefficient ofDetermination
Residual Analysis:Model Diagnostics andRemedies
4.3
ANOVA Approach toLinear Regression
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
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
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).
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
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
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
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
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
Simple LinearRegression IV
Analysis of Variance(ANOVA) Approach toRegression
Correlation andCoefficient ofDetermination
Residual Analysis:Model Diagnostics andRemedies
4.12
Correlation andCoefficient ofDetermination
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
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
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.
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
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
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
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).
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
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
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