## sequential table
fit <- lm(sr ~ ., data = LifeCycleSavings)
anova(fit)
## same effect via separate models
fit0 <- lm(sr ~ 1, data = LifeCycleSavings)
fit1 <- update(fit0, . ~ . + pop15)
fit2 <- update(fit1, . ~ . + pop75)
fit3 <- update(fit2, . ~ . + dpi)
fit4 <- update(fit3, . ~ . + ddpi)
anova(fit0, fit1, fit2, fit3, fit4, test = "F")
anova(fit4, fit2, fit0, test = "F") # unconventional order
Run the code above in your browser using DataLab