Per Glen_b's comment, your models are not nested. model1
contains an interaction term pl:species
which is not present in model2
, and model2
obviously contains terms that are not in model1
. In such cases, the $F$ test statistic does not necessarily follow an $F$ distribution, so we can't simply calculate a $p$ value.
If you change model1
by removing the problematic pl:species
interaction, anova()
will give you a $p$ value:
> model1 <- lm(sl ~ pl + sw + species + pl:sw, iris)> anova(model2, model1)Analysis of Variance TableModel 1: sl ~ I(pl^2) + I(sw^2) + species + I(pw^2) + I(pl^2):I(sw^2)Model 2: sl ~ pl + sw + species + pl:sw Res.Df RSS Df Sum of Sq F Pr(>F) 1 143 12.591 2 144 13.545 -1 -0.9535 10.829 0.001259 **---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘’ 1