Performs one-, two-way or factorial ANOVA with adjustable sums of squares method and optionally displays effect sizes ((partial) \(\eta^2\), Cohen's f) and power (calculated via pwr::pwr.f2.test to work with unbalanced designs).

tadaa_aov(formula, data = NULL, show_effect_size = TRUE,
  show_power = TRUE, factorize = TRUE, type = 3, check_contrasts = TRUE,
  print = c("df", "console", "html", "markdown"))

Arguments

formula

Formula for model, passed to aov.

data

Data for model.

show_effect_size

If TRUE (default), effect sizes partial eta^2 and Cohen's f are appended as columns.

show_power

(Experimental) If TRUE (default), power is calculated via pwr::pwr.f2.test and appended as a column.

factorize

If TRUE (default), non-factor independent variables will automatically converted via as.factor, so beware of your inputs.

type

Which type of SS to use. Default is 3, can also be 1 or 2.

check_contrasts

Only applies to type = 3. If TRUE (default), the contrasts of each non-ordered factor are set to "contr.sum".

print

Print method, default df: A regular data.frame. Otherwise passed to pixiedust::sprinkle_print_method for fancyness.

Value

A data.frame by default, otherwise dust object, depending on print.

Details

If a specified independent variable is not properly encoded as a factor, it is automatically converted if factorize = TRUE to ensure valid results.

If type = 3 and check_contrasts = TRUE, the "contrasts" of each non-ordered factor will be checked and set to contr.sum to ensure the function yields usable results. It is highly recommended to only use check_contrasts = FALSE for debugging or educational purposes, or of you know what you're doing and using your own contrast matrix.

See also

Examples

tadaa_aov(stunzahl ~ jahrgang, data = ngo)
#> term df sumsq meansq statistic p.value eta.sq.part cohens.f #> 1 jahrgang 2 536.28 268.1400 26.47825 3.813958e-11 0.1765473 0.4630322 #> 2 Residuals 247 2501.32 10.1268 NA NA NA NA #> 3 Total 249 3037.60 278.2668 NA NA NA NA #> power #> 1 0.9999996 #> 2 NA #> 3 NA
tadaa_aov(stunzahl ~ jahrgang * geschl, data = ngo)
#> term df sumsq meansq statistic p.value eta.sq.part #> 1 geschl 1 7.290 7.290000 0.7395722 3.906421e-01 0.003021874 #> 2 jahrgang 2 536.280 268.140000 27.2028672 2.163140e-11 0.182321344 #> 3 jahrgang:geschl 2 96.056 48.028000 4.8724521 8.415591e-03 0.038404335 #> 4 Residuals 244 2405.120 9.857049 NA NA NA #> 5 Total 249 3044.746 333.315049 NA NA NA #> cohens.f power #> 1 0.05505483 0.1380977 #> 2 0.47220157 0.9999998 #> 3 0.19984527 0.8047263 #> 4 NA NA #> 5 NA NA
# Other types of sums and print options
# NOT RUN { tadaa_aov(stunzahl ~ jahrgang * geschl, data = ngo, type = 1, print = "console") tadaa_aov(stunzahl ~ jahrgang * geschl, data = ngo, type = 3, print = "console") tadaa_aov(stunzahl ~ jahrgang * geschl, data = ngo, type = 3, check_contrasts = FALSE, print = "console") # }