# 1. Raw-argument interface. Bargman's (1970) example.
ci_eta_squared(F_value = 11.221, df_effect = 4, df_error = 50, N = 55)
# Same example with a 90% confidence interval.
ci_eta_squared(
F_value = 11.221, df_effect = 4, df_error = 50, N = 55,
conf_level = 0.90
)
# 2. One way ANOVA from a fitted model: mean IQ gain differs across
# the six grades of the pygmalion data (N = 310).
fit_one <- aov(iq_gain ~ factor(grade), data = pygmalion)
ci_eta_squared(fit_one)
# 3. Two-factor ANOVA: partial eta squared per effect for the
# manipulated expectancy treatment and the measured grade
# classification (pygmalion data, N = 310). The treatment by
# grade interaction is weak here (F = 1.19), so the additive
# model is used.
fit_additive <- aov(iq_8 ~ treatment + factor(grade), data = pygmalion)
ci_eta_squared(fit_additive)
# 4. Within-subjects ANOVA. CI computed against the within-subjects
# error stratum (the row reports which one via 'stratum').
set.seed(113)
n <- 20
rm_data <- data.frame(
subject = factor(rep(seq_len(n), each = 3)),
time = factor(rep(c("Pre", "Mid", "Post"), n),
levels = c("Pre", "Mid", "Post")),
y = rnorm(n, sd = 1.5)[rep(seq_len(n), each = 3)] +
0.7 * rep(1:3, n) + rnorm(n * 3, sd = 1.2)
)
fit_rm <- aov(y ~ time + Error(subject/time), data = rm_data)
ci_eta_squared(fit_rm)
Run the code above in your browser using DataLab