Quantcast
Channel: anova() does not display an F-value or p-value when comparing two models - Cross Validated
Viewing all articles
Browse latest Browse all 2

Answer by Stephan Kolassa for anova() does not display an F-value or p-value when comparing two models

$
0
0

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

Viewing all articles
Browse latest Browse all 2

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>