Skip to contents

Compute vectors associated with 1-way ANOVA

Usage

vaov(x, ...)

# S3 method for formula
vaov(x, data = parent.frame(), ...)

Arguments

x

a formula.

...

additional arguments.

data

a data frame.

Value

A data frame with variables including grandMean, groupMean, ObsVsGrand, STotal, ObsVsGroup, SError, GroupVsGrand, and STreatment. The usual SS terms can be computed from these by summing.

Details

This is primarily designed for demonstration purposes to show how 1-way ANOVA models partition variance. It may not work properly for more complicated models.

Examples


aov(pollution ~ location, data = AirPollution)
#> Call:
#>    aov(formula = pollution ~ location, data = AirPollution)
#> 
#> Terms:
#>                 location Residuals
#> Sum of Squares       468       202
#> Deg. of Freedom        2         3
#> 
#> Residual standard error: 8.205689
#> Estimated effects may be unbalanced
vaov(pollution ~ location, data = AirPollution)
#>        location pollution GrandMean GroupMean ObsVsGrand STotal ObsVsGroup
#> 1   Hill Suburb       124       120       117          4     16          7
#> 2   Hill Suburb       110       120       117        -10    100         -7
#> 3 Plains Suburb       107       120       111        -13    169         -4
#> 4 Plains Suburb       115       120       111         -5     25          4
#> 5    Urban City       126       120       132          6     36         -6
#> 6    Urban City       138       120       132         18    324          6
#>   SError GroupVsGrand STreatment
#> 1     49           -3          9
#> 2     49           -3          9
#> 3     16           -9         81
#> 4     16           -9         81
#> 5     36           12        144
#> 6     36           12        144