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

Other Tadaa-functions: tadaa_chisq, tadaa_kruskal, tadaa_levene, tadaa_nom, tadaa_normtest, tadaa_one_sample, tadaa_ord, tadaa_pairwise_gh, tadaa_pairwise_tukey, tadaa_pairwise_t, tadaa_t.test, tadaa_wilcoxon

Examples

tadaa_aov(stunzahl ~ jahrgang, data = ngo)
#> term df sumsq meansq statistic p.value eta.sq.part #> 1 jahrgang 2 536.28 268.140000 26.478251 3.8139582e-11 0.17654727 #> 2 Residuals 247 2501.32 10.126802 NA NA NA #> 3 Total 249 3037.60 278.266802 NA NA NA #> cohens.f power #> 1 0.46303218 0.99999961 #> 2 NA NA #> 3 NA NA
tadaa_aov(stunzahl ~ jahrgang * geschl, data = ngo)
#> term df sumsq meansq statistic p.value #> 1 geschl 1 7.290 7.2900000 0.73957225 3.9064211e-01 #> 2 jahrgang 2 536.280 268.1400000 27.20286722 2.1631405e-11 #> 3 jahrgang:geschl 2 96.056 48.0280000 4.87245210 8.4155912e-03 #> 4 Residuals 244 2405.120 9.8570492 NA NA #> 5 Total 249 3044.746 333.3150492 NA NA #> eta.sq.part cohens.f power #> 1 0.0030218744 0.055054825 0.13809766 #> 2 0.1823213436 0.472201569 0.99999977 #> 3 0.0384043346 0.199845270 0.80472634 #> 4 NA NA NA #> 5 NA 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") })