Learn R Programming

rstatix (version 1.1.0)

eta_squared: Effect Size for ANOVA

Description

Compute eta-squared and partial eta-squared for all terms in an ANOVA model.

See the Datanovia tutorial One-Way ANOVA in R for a worked walkthrough.

Usage

eta_squared(model, ci = NULL)

partial_eta_squared(model, ci = NULL)

Value

a named numeric vector of effect sizes, one per model term; or, when

ci is a confidence level, a tibble with the columns Effect,

effsize, conf.low and conf.high.

Arguments

model

an object of class aov or anova.

ci

confidence level for a confidence interval on the effect size. If a number between 0 and 1 (e.g. 0.95), the function returns a tibble with one row per model term and the columns Effect, effsize, conf.low and conf.high instead of the bare named vector. The interval is computed in base R by inverting the noncentral F distribution (Steiger, 2004), and matches effectsize::eta_squared(ci = , alternative = "two.sided")partial = FALSE for eta_squared() and partial = TRUE for partial_eta_squared() — to about four decimals for the non-partial bounds of a small pseudo-F (that function's inversion uses a looser tolerance), and more closely everywhere else. Default is NULL (no interval; the bare named vector is returned, unchanged).

Functions

  • eta_squared(): compute eta squared

  • partial_eta_squared(): compute partial eta squared.

References

Steiger, J. H. (2004). Beyond the F test: Effect size confidence intervals and tests of close fit in the analysis of variance and contrast analysis. Psychological Methods, 9, 164-182.

See Also

The Datanovia tutorial: One-Way ANOVA in R.

Examples

Run this code
# Data preparation
df <- ToothGrowth
df$dose <- as.factor(df$dose)

# Compute ANOVA
res.aov <- aov(len ~ supp*dose, data = df)
summary(res.aov)

# Effect size
eta_squared(res.aov)
partial_eta_squared(res.aov)

# Effect size with confidence interval
eta_squared(res.aov, ci = 0.95)
partial_eta_squared(res.aov, ci = 0.95)

Run the code above in your browser using DataLab