const data = { y: [2.1, 3.9, 6.2, 7.8, 10.1, 11.8], g: ["a", "a", "b", "b", "c", "c"] };
etaSquared(anova(lm("y ~ g", data))).colNames; // ["Eta2", "CI", "CI_low", "CI_high"]
const long = {
y: [5, 7, 8, 4, 6, 9, 6, 8, 8, 5, 5, 7],
W: ["a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c"],
id: ["s1", "s1", "s1", "s2", "s2", "s2", "s3", "s3", "s3", "s4", "s4", "s4"],
};
etaSquared(aov("y ~ W + Error(id/W)", long)).groups; // ["id:W"]
Eta squared of the terms of an analysis-of-variance table (partial by default, or generalized), with confidence intervals from the noncentral F distribution. Equivalent to
effectsize::eta_squared()in R. It takes a table ofanova()orAnova(); a fit fromlm()with a formula is replaced by itsanova()table.Repeated measures: for a fit of
aov()with anError()term (or its aovSummary) each term is measured against the residual of its error stratum, the totals add up all strata, and the result has the stratum of each row ingroups; for a result of aovEz, the same from car's univariate tests (rows as afex's table).