Assess how much of the error in prediction is due to lack of model fit.
ols_pure_error_anova(model, ...)
ols_pure_error_anova
returns an object of class
"ols_pure_error_anova"
. An object of class "ols_pure_error_anova"
is a
list containing the following components:
lack of fit sum of squares
pure error sum of squares
regression sum of squares
error sum of squares
total sum of squares
regression mean square
error mean square
lack of fit mean square
pure error mean square
f statistic
lack of fit f statistic
p-value of f statistic
p-value pf lack of fit f statistic
data.frame
containing data for the response and predictor of the model
regression sum of squares degrees of freedom
error sum of squares degrees of freedom
lack of fit degrees of freedom
pure error degrees of freedom
data.frame; contains computed values used for the lack of fit f test
character vector; name of response variable
character vector; name of predictor variable
An object of class lm
.
Other parameters.
The residual sum of squares resulting from a regression can be decomposed into 2 components:
Due to lack of fit
Due to random variation
If most of the error is due to lack of fit and not just random error, the model should be discarded and a new model must be built.
Kutner, MH, Nachtscheim CJ, Neter J and Li W., 2004, Applied Linear Statistical Models (5th edition). Chicago, IL., McGraw Hill/Irwin.
model <- lm(mpg ~ disp, data = mtcars)
ols_pure_error_anova(model)
Run the code above in your browser using DataLab