The Analysis of Variance (ANOVA) is used to explore the relationship between a continuous dependent variable, and one or more categorical explanatory variables. This ‘One-Way ANOVA’ is a simplified version of the ‘normal’ ANOVA, allowing only a single explanatory factor, however also providing a Welch’s ANOVA. The Welch’s ANOVA has the advantage that it need not assume that the variances of all groups are equal.

For convenience, this method allows specifying multiple dependent variables, resulting in multiple independent tests.

Note that the Welch’s ANOVA is the same procedure as the Welch’s independent samples t-test.

Example usage

dat <- ToothGrowth
dat$dose <- factor(dat$dose)

anovaOneW(formula = len ~ dose, data = dat)

#  One-Way ANOVA (Welch's)
#  ────────────────────────────────────────
#           F       df1    df2     p
#  ────────────────────────────────────────
#    len    68.4      2    37.7    < .001
#  ────────────────────────────────────────


data the data as a data frame
deps a string naming the dependent variables in data
group a string naming the grouping or independent variable in data
welchs TRUE (default) or FALSE, perform Welch's one-way ANOVA which does not assume equal variances
fishers TRUE or FALSE (default), perform Fisher's one-way ANOVA which assumes equal variances
miss 'perAnalysis' or 'listwise', how to handle missing values; 'perAnalysis' excludes missing values for individual dependent variables, 'listwise' excludes a row from all analyses if one of its entries is missing.
desc TRUE or FALSE (default), provide descriptive statistics
descPlot TRUE or FALSE (default), provide descriptive plots
norm TRUE or FALSE (default), perform Shapiro-Wilk test of normality
qq TRUE or FALSE (default), provide a Q-Q plot of residuals
eqv TRUE or FALSE (default), perform Levene's test for equality of variances
phMethod 'none', 'gamesHowell' or 'tukey', which post-hoc tests to provide; 'none' shows no post-hoc tests, 'gamesHowell' shows Games-Howell post-hoc tests where no equivalence of variances is assumed, and 'tukey' shows Tukey post-hoc tests where equivalence of variances is assumed
phMeanDif TRUE (default) or FALSE, provide mean differences for post-hoc tests
phSig TRUE (default) or FALSE, provide significance levels for post-hoc tests
phTest TRUE or FALSE (default), provide test results (t-value and degrees of freedom) for post-hoc tests
phFlag TRUE or FALSE (default), flag significant post-hoc comparisons


A results object containing:

results$anova a table
results$desc a table
results$assump$norm a table
results$assump$eqv a table
results$plots an array of groups
results$postHoc an array of tables

Tables can be converted to data frames with asDF or For example:


Elements in arrays can be accessed with [[n]]. For example:

results$plots[[1]] # accesses the first element