Title: Lack of Fit (LOF) Test
1Lack of Fit (LOF) Test
- A formal F test for checking whether a specific
type of regression function adequately fits the
data
2Example 1
Do the data suggest that a linear function is
adequate in describing the relationship between
skin cancer mortality and latitude?
3Example 2
Do the data suggest that a linear function is
adequate in describing the relationship between
the length and weight of an alligator?
4Example 3
Do the data suggest that a linear function is
adequate in describing the relationship between
iron content and weight loss due to corrosion?
5Lack of fit test for a linear function the
basic idea
- Use general linear test approach.
- Full model is most general model with no
restrictions on the means µj at each Xj level. - Reduced model assumes that the µj are a linear
function of the Xj, i.e., µj ß0 ß1Xj. - Determine SSE(F), SSE(R), and F statistic.
- If the P-value is small, reject the reduced model
(H0 No lack of fit (linear)) in favor of the
full model (HA Lack of fit (not linear)).
6Assumptions and requirements
- The Y observations for a given X level are
independent. - The Y observations for a given X level are
normally distributed. - The distribution of Y for each level of X has the
same variance. - LOF test requires repeat observations, called
replications (or replicates), for at least one of
the X values.
7Notation
iron wgtloss 0.01 127.6 0.01 130.1 0.01
128.0 0.48 124.0 0.48 122.0 0.71 110.8 0.71
113.1 0.95 103.9 1.19 101.5 1.44 92.3 1.44
91.4 1.96 83.7 1.96 86.2
- c different levels of X (c7 with X10.01,
X20.48, , X71.96) - nj number of replicates for jth level of X
(Xj) (n13, n22, , n72) for a total of n n1
nc observations. - Yij observed value of the response variable
for the ith replicate of Xj (Y11127.6,
Y21130.1, , Y2786.2)
8The Full Model
Assume nothing about (or put no structure on)
the means of the responses, µj, at the jth level
of X
Make usual assumptions about error terms (eij)
normal, mean 0, constant variance s2.
Least squares estimates of µj are sample means of
responses at Xj level.
Pure error sum of squares
9The Reduced Model
Assume the means of the responses, µj, are
linearly related to the jth level of X (same
model as before, just modified subscripts)
Make usual assumptions about error terms (eij)
normal, mean 0, constant variance s2.
Least squares estimates of µj are as usual.
Error sum of squares
10Error sum of squares decomposition
error deviation
pure error deviation
lack of fit deviation
11The F test
12The Decision (Intuitively)
- If the largest portion of the error sum of
squares is due to lack of fit, the F test should
be large. - A large F statistic leads to a small P-value
(determined by F(c-2, n-2) distribution). - If P-value is small, reject null and conclude
significant lack of (linear) fit.
13LOF Test summarized in an ANOVA Table
14LOF Test in Minitab
- Stat gtgt Regression gtgt Regression
- Specify predictor and response.
- Under Options, under Lack of Fit Tests, select
box labeled Pure error. - Select OK. Select OK. ANOVA table appears in
session window.
15Example 1
Do the data suggest that a linear function is
adequate in describing the relationship between
skin cancer mortality and latitude?
16Example 1 Mortality and Latitude
Analysis of Variance Source DF SS
MS F P Regression 1 36464 36464
99.80 0.000 Residual Error 47 17173 365
Lack of Fit 30 12863 429 1.69 0.128 Pure
Error 17 4310 254 Total 48
53637 19 rows with no replicates
17Example 2
Do the data suggest that a linear function is
adequate in describing the relationship between
the length and weight of an alligator?
18Example 2 Alligator length and weight
Analysis of Variance Source DF SS
MS F P Regression 1 342350 342350
117.35 0.000 Residual Error 23 67096 2917
Lack of Fit 17 66567 3916 44.36 0.000
Pure Error 6 530 88 Total 24
409446 14 rows with no replicates
19Example 3
Do the data suggest that a linear function is
adequate in describing the relationship between
iron content and weight loss due to corrosion?
20Example 3 Iron and corrosion
Analysis of Variance Source DF SS
MS F P Regression 1 3293.8 3293.8
352.27 0.000 Residual Error 11 102.9 9.4
Lack of Fit 5 91.1 18.2 9.28 0.009
Pure Error 6 11.8 2.0 Total 12
3396.6 2 rows with no replicates
21Closing comment 1
- The t-test or FMSR/MSE test only tests whether
there is a linear relation between the predictor
and response (ß1?0) or not (ß10). - Failing to reject the null does not imply that
there is no relation between the predictor and
response.
22Example Closing comment 1
23Example Closing comment 1
The regression equation is Y 14.1 - 0.100
X Predictor Coef SE Coef T
P Constant 14.118 2.598
5.44 0.000 X -0.0998 0.6942
-0.14 0.887 S 13.25 R-Sq 0.1
R-Sq(adj) 0.0 Analysis of Variance Source
DF SS MS F
P Regression 1 3.6 3.6 0.02
0.887 Residual Error 24 4210.4 175.4 Lack of
Fit 11 4188.3 380.8 223.87 0.000 Pure
Error 13 22.1 1.7 Total 25
4214.0
24Closing comments 2, 3
- We used general linear test approach to test
appropriateness of a linear function. It can
just as easily be used to test for
appropriateness of other functions (quadratic,
cubic). - The alternative HA Lack of fit (not linear)
includes all possible regression functions other
than a linear one. Use residuals to help
identify what type of function is appropriate.