
Two-way ANOVA with sequential (Type I) sums of squares
Source:R/anova_twoway.R
morie_anova_twoway.RdFits y = mu + alpha_i + delta_j (Hedderich, Sachs & Reynarowych 2023, eq
8.47) or, with interaction = TRUE, adds gamma_ij (eq 8.48), and gives
SS(A), SS(B | A) and SS(AB | A, B) as drops in the residual sum of squares
as each block of dummy columns is added: anova(lm(y ~ a + b)) or
anova(lm(y ~ a * b)), balanced or not.
Value
Named list: F, p_value, df (factor A), ss_a, ss_b, ss_resid, df_b, df_resid, f_b, p_b and, with interaction, ss_ab, df_ab, f_ab, p_ab.
References
Hedderich, J., Sachs, L. & Reynarowych, Z. (2023). Applied Statistics: Methods Using R. Eqs (8.47)-(8.48).
Examples
d <- data.frame(y = c(3, 4, 5, 3.5, 5, 6, 2, 3, 4.5, 2.5, 3.2, 4), a = rep(1:2, each = 6),
b = rep(1:3, 4))
morie_anova_twoway(d, interaction = TRUE)$f_ab
#> [1] 0.1756272