STAT1400 2022 1st Week4-Lecture 8
STAT1400 2022 1st Week4-Lecture 8
STAT1400 2022 1st Week4-Lecture 8
au/learning/resources/ace/
respect-intellectual-property/copyright-and-uwa-unit-content
stat1400-ems@uwa.edu.au
Contributors to lecture material: Adrian Baddeley, Adriano Polpo, John Bamberg, Ed Cripps, Julie Marsh, Kevin Murray,
Gordon Royle, and Berwin Turlach.
y = mx + c
where
m is the slope or gradient
c is the y-intercept.
Plotting lines
10
8 y= 1x + 8
6 y = 0.5x + 3
1 2 3 4 5 6 7 8 9 10
Residuals
14
12 “residual”
10
2 4 6 8 10 12 14
Method of Least Squares
is as small as possible.
is as small as possible.
y = 86.088 + 0.514x
So the best guess for the height of the son of a 180cm father
would be
86.088 + 0.514 ⇥ 180 = 178.76.
The best line
The Anscombe Quartet
60
Anscombe Regression Lines
The line is called the fitted line and expressed in the form
ŷ = b0 + b1 x.
14
12
10
2 4 6 8 10 12 14
Are residuals errors?
yˆi = b0 + b1 xi
So put
ei = yi yˆi
and call this the residual or error. It is the di↵erence between the
observed value and the fitted value.
Residual Plot
A residual plot is a plot whose vertical axis is the residuals, and
whose horizontal axis is the predictor variable or the fitted value.
Residual Analysis
Is there a pattern?
Are they centred around zero?
Are there any outliers?
Is the variance of the residuals roughly constant?
Satisfactory Residual Analysis
● ●
6
●
● ●
●●
4
● ●
● ●● ●
●
● ●
●● ● ●
4
● ●
● ●
Response
Response
●● ●
●
2
● ●
●
●
● ●
2
● ● ● ●
● ●● ● ●
● ● ● ●
0
● ●
● ● ●
0
● ●
●
● ● ●
● ● ● ● ●
−2
● ●● ● ●● ● ●
● ● ● ● ●
−2
●
● ● ●
● ●
−2 −1 0 1 2 −2 −1 0 1 2
2
● ● ●
● ● ● ● ●
● ●
● ●
●
1
● ● ● ● ●
● ● ● ● ●
0.5
● ● ● ●
● ●
Residuals
Residuals
● ● ● ●
●
● ● ● ● ● ●
0
● ● ● ●
● ● ●
● ● ●
●
● ●● ●
−0.5
● ● ● ● ●
●
−1
● ● ●● ●
● ● ●
● ●
●
● ● ● ●
● ●
−2
● ●
−1.5
● ●
−2 0 2 4 −2 0 2 4
10
● ●
●●
50
●
8
●
●
40
●
● ● ●
Response
Response
6
●●
30
● ●
● ●
●
●
4
● ● ●
● ●
20
● ●
● ●
● ●● ●
2 ● ● ●
● ●●
● ●
10
●
● ● ●●●
●● ● ●
● ● ●
●●●● ●●● ●
●●
0
0
● ●
−2 −1 0 1 2 −2 −1 0 1 2
● ●
30
6
●●
●
● ●
4
20
●
●
Residuals
Residuals
●
●● ●
2
●
● ●
10
● ● ●
● ● ●●● ●●
0
● ● ● ●
● ● ● ● ●
● ● ●
● ● ●● ●
●
●●●
0
● ●●●
−2
● ● ●● ●
● ● ● ●
●● ●●● ●● ●●
●
●● ●●●●
−10
●
−4
● ●●●●
6
● ●
10
●
● ●
● ● ●
● ● ●●
4
●
● ●
5
● ●● ●●
●
● ● ●● ● ● ● ●
● ● ● ●
● ● ● ●●
2
● ● ● ● ●
0
● ● ●
Response
Response
● ● ●
● ● ●
● ● ●
● ● ● ● ●
0
● ● ●
●
● ●● ●
● ● ● ●
−6 −4 −2
● ● ●
−10
● ●
●
● ●
●
● ● ●
−20
●
● ●
−2 −1 0 1 2 −2 −1 0 1 2
10 15
● ●
4
● ●
● ● ● ● ●
● ●●
●● ● ●
2
● ● ●● ● ●
● ● ● ● ● ● ● ● ●
5
● ● ● ●
●
0
Residuals
Residuals
●
● ● ● ● ● ●● ● ● ●
● ● ● ●● ●
● ● ● ●● ●●●
0
● ●
−8 −6 −4 −2
● ● ● ● ● ●
● ●
● ● ● ● ●
● ●
−5
● ●
−15 ●
●
●
● ● ● ●
−1 0 1 2 −4 −2 0 2 4