# pureErrorAnova: Pure Error analysis of variance In alr3: Data to accompany Applied Linear Regression 3rd edition

## Description

For a linear model object, finds the sum of squares for lack of fit and the sum of squares for pure error. These are added to the standard anova table to give a test for lack of fit. If there is no pure error, then the regular anova table is returned.

## Usage

 ```1 2 3 4 5 6 7 8``` ```### This is a generic function. pureErrorAnova(mod) ## S3 method for class 'lm' pureErrorAnova(mod) ### Methods for other than models for type lm have not been defined. ```

## Arguments

 `mod` an object of type `lm`

## Details

For regression models with one predictor, say `y ~ x`, this method fits `y ~ x + factor(x)` and prints the anova table. With more than one predictor, it computes a random linear combination L of the terms in the mean function and then gives the anova table for `update(mod, ~.+factor(L))`.

## Value

Returns an analsis of variance table.

## Author(s)

Sanford Weisberg, [email protected]

## References

Weisberg, S. (2005). Applied Linear Regression, third edition, New York: Wiley, Chapter 5.

`lm`
 ```1 2 3 4 5 6 7 8 9``` ```x <- c(1,1,1,2,3,3,4,4,4,4) y <- c(2.55,2.75,2.57,2.40,4.19,4.70,3.81,4.87,2.93,4.52) m1 <- lm(y~x) anova(m1) # ignore pure error pureErrorAnova(m1) # include pure error head(forbes) m2 <- lm(Lpres~Temp, data=forbes) pureErrorAnova(m2) # function does nothing because there is no pure error ```