Tests for equal means in a one-way design (not assuming equal variance). A wrapper around the base function oneway.test(). This is is an alternative to the standard one-way ANOVA in the situation where the homogeneity of variance assumption is violated.

welch_anova_test(data, formula)

## Arguments

data

a data frame containing the variables in the formula.

formula

a formula specifying the ANOVA model similar to aov. Can be of the form y ~ group where y is a numeric variable giving the data values and group is a factor with one or multiple levels giving the corresponding groups. For example, formula = TP53 ~ cancer_group.

## Value

return a data frame with the following columns:

• .y.: the y variable used in the test.

• n: sample count.

• statistic: the value of the test statistic.

• p: p-value.

• method: the statistical test used to compare groups.

## Examples

# Load data
#:::::::::::::::::::::::::::::::::::::::
data("ToothGrowth")
df <- ToothGrowth
df$dose <- as.factor(df$dose)

# Welch one-way ANOVA test (not assuming equal variance)
#:::::::::::::::::::::::::::::::::::::::::
df %>% welch_anova_test(len ~ dose)
#> # A tibble: 1 × 7
#>   .y.       n statistic   DFn   DFd        p method
#> * <chr> <int>     <dbl> <dbl> <dbl>    <dbl> <chr>
#> 1 len      60      68.4     2  37.7 2.81e-13 Welch ANOVA

# Grouped data
#:::::::::::::::::::::::::::::::::::::::::
df %>%
group_by(supp) %>%
welch_anova_test(len ~ dose)
#> # A tibble: 2 × 8
#>   supp  .y.       n statistic   DFn   DFd            p method
#> * <fct> <chr> <int>     <dbl> <dbl> <dbl>        <dbl> <chr>
#> 1 OJ    len      30      29.4     2  17.1 0.00000295   Welch ANOVA
#> 2 VC    len      30      59.4     2  17.2 0.0000000194 Welch ANOVA