Calculates and displays type-II analysis-of-variance tables for model objects produced by aov. This is a vastly reduced version of the Anova function from package car

aovtype2(mod)

Arguments

mod

aov model object from base R.

Value

An object of class "anova", which usually is printed.

Details

Details about how the function works in order of steps taken. Type-II tests are invariant with respect to (full-rank) contrast coding. Type-II tests are calculated according to the principle of marginality, testing each term after all others, except ignoring the term's higher-order relatives. This definition of Type-II tests corresponds to the tests produced by SAS for analysis-of-variance models, where all of the predictors are factors, but not more generally (i.e., when there are quantitative predictors).

References

: Fox, J. (2016) Applied Regression Analysis and Generalized Linear Models, Third Edition. Sage.

See also

Author

John Fox jfox@mcmaster.ca; as modified by Chuck Powell

Examples

mtcars$cyl <- factor(mtcars$cyl) mtcars$am <- factor(mtcars$am) mod <- aov(hp ~ cyl * am, data = mtcars) aovtype2(mod)
#> Anova Table (Type II tests) #> #> Response: hp #> Sum Sq Df F value Pr(>F) #> cyl 102729 2 60.1644 1.759e-10 *** #> am 7318 1 8.5716 0.007009 ** #> cyl:am 12181 2 7.1341 0.003390 ** #> Residuals 22197 26 #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1