Académique Documents
Professionnel Documents
Culture Documents
WEEK 2
1 / 64
Assessing the Model
Analysis of Variance
F test
Estimating σ 2
Coefficient of Determination
Minitab Example
Residuals
Crude Residuals
Standardized/Studentized Residuals
Residuals Diagnostics
Inference about the regression parameters
Example: Overheads
2 / 64
Assessing the Model
Analysis of Variance
Yi = β0 + β1 xi + εi
That is,
[i ) = Ybi = βb0 + βb1 xi , i = 1, . . . , n.
E(Y
[i ) for a given data set (xi , yi ), are called fitted
Values of E(Y
3 / 64
Assessing the Model
Analysis of Variance
I They are points on the fitted regression line corresponding
to values xi .
I The observed values yi usually do not fall exactly on the
line and so are usually not equal to the fitted values ybi , as it
is shown in the figure below.
4
y
1
0 2 4 6 8 10 12 14 16 18
x
4 / 64
Assessing the Model
Analysis of Variance
The residuals (also called crude residuals) are defined as
ei := Yi − Ybi , i = 1, . . . , n,
ei = Yi − (βb0 + βb1 xi )
5 / 64
Assessing the Model
Analysis of Variance
I Note that the estimators βb0 and βb1 minimize the function
S(β0 , β1 ).
I The minimum is called the Residual Sum of Squares and is
denoted by SSE .
That is,
n
X
SSE = [Yi − (βb0 + βb1 xi )]2
i=1
Xn
= (Yi − Ybi )2
i=1
Xn
= e2i .
i=1
6 / 64
Assessing the Model
Analysis of Variance
Yi = β0 + εi .
Y
10
y
4
0
0 2 4 6 8 10 X
7 / 64
Assessing the Model
Analysis of Variance
Ybi = Ȳ
ei = Yi − Ybi = Yi − Ȳ
and
n
X
SSE = SST = (Yi − Ȳ)2 .
i=1
8 / 64
Assessing the Model
Analysis of Variance
When the model is non constant, the difference Yi − Ȳ can be
split into two components: one due to the regression model fit
and one due to the residuals. That is
y
y(14)
5
y(14)
4
fitted line
y
2
1
x
0 2 4 6 8 10 12 14 16 18
9 / 64
Assessing the Model
Analysis of Variance Identity
Theorem
In the simple linear regression model the total sum of squares
is a sum of the regression sum of squares and the residual sum
of squares, that is
SST = SSR + SSE ,
where
n
X
SST = (Yi − Ȳ)2
i=1
n
X
SSR = (Ybi − Ȳ)2
i=1
n
X
SSE = (Yi − Ybi )2
i=1
10 / 64
Assessing the Model
Analysis of Variance Identity
Proof
n
X n
X
SST = (Yi − Ȳ)2 = [(Yi − Ybi ) + (Ybi − Ȳ)]2
i=1 i=1
n
X
= [(Yi − Ybi )2 + (Ybi − Ȳ)2 + 2(Yi − Ybi )(Ybi − Ȳ)]
i=1
11 / 64
Assessing the Model
Analysis of Variance Identity
n
X
A = (Yi − Ybi )(Ybi − Ȳ)
i=1
Xn n
X
= (Yi − Ybi )Ybi − Ȳ (Yi − Ybi )
i=1 i=1
n
X n
X
= ei Ybi − Ȳ ei
i=1 i=1
| {z }
=0
n
X n
X n
X
= ei (βb0 + βb1 xi ) = βb0 ei + βb1 ei xi .
i=1 i=1 i=1
| {z } | {z }
=0 =0
Hence A = 0.
12 / 64
Assessing the Model
Analysis of Variance
13 / 64
Assessing the Model
ANOVA Table
ANOVA table
Source of variation d.f. SS MS VR
SSR MSR
Regression νR = 1 SSR MSR = νR MSE
SSE
Residual νE = n − 2 SSE MSE = νE
Total νT = n − 1 SST
14 / 64
Assessing the Model
ANOVA Table
15 / 64
Assessing the Model
F-test
H0 : β1 = 0
16 / 64
Assessing the Model
F-test
17 / 64
Assessing the Model
F-test
Yi = β0 + εi .
18 / 64
Assessing the Model
Estimating σ 2
Theorem.
In the full simple linear regression model we have
E(SSE ) = (n − 2)σ 2
It is often denoted by S2 .
19 / 64
Assessing the Model
Estimating σ 2
We have
n
2 1 X [i ))2 , [i ) = βb0 + βb1 xi .
S = MSE = (Yi − E(Y where E(Y
n−2
i=1
n
1 X
S2 = (Yi − Ȳ)2 .
n−1
i=1
20 / 64
Assessing the Model
Coefficient of Determination R2
Note:
I R2 ∈ [0, 100].
I R2 = 0 indicates that none of the variability in the response
is explained by the regression model.
I R2 = 100 indicates that SSE = 0 and all observations fall on
the fitted line exactly.
I A small value of R2 does not always imply a poor
relationship between Y and X, which may, for example,
follow another model.
21 / 64
Assessing the Model
Exammple: Sparrows’ Wings continued
22 / 64
Assessing the Model
Exammple: Sparrows’ Wings continued
Analysis of Variance
Source DF SS MS F P
Regression 1 82.216 82.216 5787.39 0.000
Residual Error 53 0.753 0.014
Total 54 82.969
23 / 64
Assessing the Model
Exammple: Sparrows’ Wings continued
Comments:
I We fitted a simple linear model of the form
Yi = β0 + β1 xi + εi , i = 1, . . . , 55, εi ∼ N (0, σ 2 ).
iid
I intercept: βb0 ∼
= 0.550
I slope: βb1 ∼
= 0.303
24 / 64
Assessing the Model
Exammple: Sparrows’ Wings continued
H0 : β1 = 0
25 / 64
Assessing the Model
Exammple: Sparrows’ Wings continued
26 / 64
Assessing the Model
Exammple: Sparrows’ Wings continued
Final conclusions:
We can conclude that the data indicate that the length of
sparrows’ wings depends linearly on their age (within the range
3 - 18 days). The mean increase in the wing’s length per day is
estimated as βb1 ∼
= 0.303 cm.
27 / 64
Residuals
Crude Residuals
ei = Yi − Y
bi .
28 / 64
Residuals
Crude Residuals
Expectation:
Variance:
1 (xi − x̄)2
2
var[ei ] = σ 1 − + := σ 2 (1 − hii ).
n Sxx
29 / 64
Residuals
Crude Residuals
bi = Yi − βb0 − βb1 xi
ei = Yi − Y
= Yi − Y − βb1 (xi − x)
n
X
= Yi − Y − cj Yj (xi − x)
j=1
n n
1X X
= Yi − Yj − cj Yj (xi − x)
n
j=1 j=1
n
X 1
= Yi − + (xi − x)cj Yj
n
j=1
X 1
1
= 1− + (xi − x)ci Yi − + (xi − x)cj Yj
n n
j6=i
30 / 64
Residuals
Crude Residuals
Furthermore, var(Yj ) = σ 2 , j = 1, . . . , n.
31 / 64
Residuals
Crude Residuals
Hence,
2 X 1 2
1
var(ei ) = σ 2 1 − + (xi − x)ci + σ2 + (xi − x)cj
n n
j6=i
2 X 2
1 1 1
= σ2 1 − 2 + (xi − x)ci + + (xi − x)ci + + (xi − x)cj
n n n
j6=i
X n 2
1 1
= σ2 1 − 2 + (xi − x)ci + + (xi − x)cj
n n
j=1
1 (xi − x̄)2
= . . . = σ2 1 − +
n Sxx
Pn Pn
by j=1 cj = 0 and j=1 c2j = S1xx .
32 / 64
Residuals
Crude Residuals
33 / 64
Residuals
Standardized/Studentized Residuals
Then
di ∼ N (0, 1).
They are not independent, though for large samples the
correlation should be small.
34 / 64
Residuals
Standardized/Studentized Residuals
35 / 64
Residuals Diagnostics
Residual Plots
To check constant variance (homoscedasticity) and also
linearity, we plot ri against xi , as it is shown below or against byi
as shown in the next set of figures.
(a) (b)
(a) (b)
37 / 64
Residuals Diagnostics
Histograms of Simulated Data from Four Different Distributions
38 / 64
Residuals Diagnostics
Cumulative distributions: Empirical and Predicted
40 / 64
Residuals Diagnostics
Normal Probability Plot: Data from Normal Distribution
(a) (b)
(a) (b)
(a) (b)
43 / 64
Residuals Diagnostics
Normal Probability Plot: Data from Student t-Distribution
(a) (b)
44 / 64
Residuals Diagnostics
Normal Probability Plot: Sparrows’s Wings
MINITAB
Stat → Basic Statistics → Normality Test...
45 / 64
Inference about the regression parameters
Example: Overheads
46 / 64
Inference about the regression parameters
Example: Overheads
47 / 64
Inference about the regression parameters
Example: Overheads
The regression equation is
Ovhd = 16310 + 11.0 Labor
Analysis of Variance
Source DF SS MS F P
Regression 1 63517077 63517077 23.46 0.000
Residual Error 14 37912232 2708017
Total 15 101429309
MINITAB
Stat → Regression → Regression...
48 / 64
Inference about the regression parameters
Example: Overheads
(a) (b)
Comments:
50 / 64
Inference about the regression parameters
Inference about β1
Theorem
In the full simple linear regression model (SLRM) the
distribution of the LSE of β1 , βb1 , is normal with the expectation
2
E(βb1 ) = β1 and the variance var(βb1 ) = Sσxx , that is
σ2
βb1 ∼ N β1 , .
Sxx
Remark
For large samples, where there is no assumption of normality of
Yi , the sampling distribution of βb1 is approximately normal.
51 / 64
Inference about the regression parameters
Inference about β1
βb1 − β1
√ ∼ N (0, 1).
σ/ Sxx
52 / 64
Inference about the regression parameters
Inference about β1
Lemma
If Z ∼ N(0, 1) and U ∼ χ2ν , and Z and U are independent, then
Z
p ∼ tν .
U/ν
Here we have,
βb1 − β1
Z= √ ∼ N (0, 1).
σ/ Sxx
We will see later that
(n − 2)S2
U= ∼ χ2n−2
σ2
It follows that
−β1
βb1√
σ/ Sxx
T=q
(n−2)S2
σ 2 (n−2)
βb1 − β1
= √ ∼ tn−2 .
S/ Sxx
54 / 64
Inference about the regression parameters
Inference about β1 : Confidence Interval
Here we have
!
βb1 − β1
P −t α2 ,n−2 < √ < t α2 ,n−2 = 1 − α,
S/ Sxx
55 / 64
Inference about the regression parameters
Inference about β1 : Confidence Interval
This gives
S S
P βb1 − t α2 ,n−2 √ < β1 < βb1 + t α2 ,n−2 √ = 1 − α.
Sxx Sxx
56 / 64
Inference about the regression parameters
Inference about β1 : Confidence Interval
Example continued
For the given data we obtained values of βb1 , S and Sxx for the
overhead costs:
57 / 64
Inference about the regression parameters
Inference about β1 : Test of H0 : β1 = 0
Yi = β0 + εi , εi ∼ N (0, σ 2 )
iid
βb1 − β1
T= √ ∼ tn−2 .
S/ Sxx
βb1
T= ∼ tn−2 .
√S H0
Sxx
58 / 64
Inference about the regression parameters
Inference about β1 : Test of H0 : β1 = 0
59 / 64
Inference about the regression parameters
Inference about β1 : Test of H0 : β1 = 0
Remark
Square root of the variance var(βb1 ) is called the standard error
of βb1 and it is denoted by se(βb1 ).
That is s
σ2
se(βb1 ) = .
Sxx
Its estimator is s
\ S2
se(βb1 ) = .
Sxx
Often this estimated standard error is called the standard error.
You should be aware of the difference between the two.
60 / 64
Inference about the regression parameters
Inference about β1 : Test of H0 : β1 = 0
Remark
Note that the (1 − α)100% CI for β1 can be written as
\ \
β1 − t 2 ,n−2 se(β1 ), β1 + t 2 ,n−2 se(β1 )
b α b b α b
βb1
T= ∼ tn−2 .
\
se(β1 )
b
61 / 64
Inference about the regression parameters
Inference about β0
Theorem
In the full SLM the distribution of the LSE of β0 , βb0 , is normal
with the expectation
E(β0 ) = β0 and the variance
b
2
var(βb0 ) = 1n + Sx̄xx σ 2 , that is
x̄2
2 1
βb0 ∼ N β0 , σ + .
n Sxx
62 / 64
Inference about the regression parameters
Inference about β0
Corollary
Assuming the full simple linear regression model, we obtain
CI for β0 :
\ \
β0 − t α2 ,n−2 se(β0 ), β0 + t α2 ,n−2 se(β0 )
b b b b
βb0 − β0?
T= ∼ tn−2 ,
\ H0
se(β0 )
b
where s
x̄2
\ 1
se(βb0 ) = S2 + .
n Sxx
63 / 64
Inference about the regression parameters
Inference about β0
Example continued
The calculated values for the overhead costs are following:
\
βb0 = 16310, se(βb0 ) = 2421
= [11117.5, 21502.5]
64 / 64