I have a regression model with a polynomial term and I am using ANOVA to test for the significance of the terms. I have been asked to report the linear and quadratic terms separately for the polynomial term, but can't seem to do this in R using either stats::anova()
or car::Anova()
.
The model summary
function reports test statistics for each term separately, is there a way to do this using with an ANOVA? Or is there maybe a good reason why the ANOVA functions don't do this?
Reproducible example:
data(iris)
mod<-lm(Petal.Length ~ Species + poly(Petal.Width,2),data=iris)
Anova(mod) #gives output for "poly(Petal.Width, 2)"
summary(mod) #gives output for "poly(Petal.Width, 2)1" and "poly(Petal.Width, 2)2"
It does work if I specify the model as mod<-lm(Petal.Length ~ Species + Petal.Width + I(Petal.Width^2),data=iris)
but after reading around it seems that poly()
is more appropriate in most cases so I would prefer to use that if possible.