tadaa_aov: Tadaa, ANOVA!

Description Usage Arguments Details Value See Also Examples

View source: R/tadaa_omnibus.R

Description

Performs one-, two-way or factorial ANOVA with adjustable sums of squares method and optionally displays effect sizes ((partial) η^2 and Cohen's f).

Usage

1
2
3
4
5
6
7
8
9
tadaa_aov(
  formula,
  data = NULL,
  show_effect_size = 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.

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.

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.

Value

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

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
tadaa_aov(stunzahl ~ jahrgang, data = ngo)
tadaa_aov(stunzahl ~ jahrgang * geschl, data = ngo)

# 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"
)

## End(Not run)

Example output

       term  df   sumsq   meansq statistic      p.value eta.sq.part  cohens.f
1 Residuals 247 2501.32  10.1268        NA           NA          NA        NA
2     Total 249 3037.60 278.2668        NA           NA          NA        NA
3  jahrgang   2  536.28 268.1400  26.47825 3.813958e-11   0.1765473 0.4630322
      power
1        NA
2        NA
3 0.9999996
             term  df    sumsq     meansq  statistic      p.value eta.sq.part
1       Residuals 244 2405.120   9.857049         NA           NA          NA
2           Total 249 3044.746 333.315049         NA           NA          NA
3          geschl   1    7.290   7.290000  0.7395722 3.906421e-01 0.003021874
4        jahrgang   2  536.280 268.140000 27.2028672 2.163140e-11 0.182321344
5 jahrgang:geschl   2   96.056  48.028000  4.8724521 8.415591e-03 0.038404335
    cohens.f     power
1         NA        NA
2         NA        NA
3 0.05505483 0.1380977
4 0.47220157 0.9999998
5 0.19984527 0.8047263
Table 1: **Two-Way ANOVA**: Using Type I Sum of Squares

             Term  df      SS     MS    F      p $\\eta_\\text{part}^2$
1          geschl   1    0.14   0.14 0.01   .904                      0
2        jahrgang   2  536.28 268.14 27.2 < .001                   0.18
3 jahrgang:geschl   2   96.06  48.03 4.87  < .01                   0.04
4       Residuals 244 2405.12   9.86                                   
5           Total 249  3037.6 326.17                                   
  Cohen's f Power
1      0.01  0.05
2      0.47     1
3       0.2   0.8
4                
5                


Table 2: **Two-Way ANOVA**: Using Type III Sum of Squares

             Term  df      SS     MS    F      p $\\eta_\\text{part}^2$
1          geschl   1    7.29   7.29 0.74   .391                      0
2        jahrgang   2  536.28 268.14 27.2 < .001                   0.18
3 jahrgang:geschl   2   96.06  48.03 4.87  < .01                   0.04
4       Residuals 244 2405.12   9.86                                   
5           Total 249 3044.75 333.32                                   
  Cohen's f Power
1      0.06  0.14
2      0.47     1
3       0.2   0.8
4                
5                


Table 3: **Two-Way ANOVA**: Using Type III Sum of Squares

             Term  df      SS     MS    F     p $\\eta_\\text{part}^2$
1          geschl   1    4.84   4.84 0.49  .484                      0
2        jahrgang   2   95.65  47.82 4.85 < .01                   0.04
3 jahrgang:geschl   2   96.06  48.03 4.87 < .01                   0.04
4       Residuals 244 2405.12   9.86                                  
5           Total 249 2601.66 110.55                                  
  Cohen's f Power
1      0.04  0.11
2       0.2   0.8
3       0.2   0.8
4                
5                


Warning message:
In EtaSq.lm(base_model, type = type) :
  Factors jahrgang, geschl are not associated with sum-to-zero contrasts necessary for valid SS type III when cell sizes are unbalanced and interactions are present. Consider re-fitting the model after setting options(contrasts=c("contr.sum", "contr.poly"))

tadaatoolbox documentation built on July 2, 2020, 2:30 a.m.