Skip to contents

One-way random model y_ij = mu + a_i + e_ij. With SSA = sum_i n_i (ybar_i - ybar)^2, SSE = sum_ij (y_ij - ybar_i)^2, MSA = SSA/(a-1) and MSE = SSE/(N-a), the ANOVA estimators are sigma_e^2 = MSE and sigma_a^2 = (MSA - MSE)/n_0 with n_0 = (N - sum_i n_i^2 / N)/(a - 1), which reduces to Searle et al.'s Eq. (21) form (MSA - MSE)/n for balanced data. Unbiased but possibly negative, so both the raw and the zero-truncated values are returned.

Usage

morie_ranova(y, group)

Arguments

y

Observations.

group

Class label per observation.

Value

A list with elements sigma2_a, sigma2_e, sigma2_a_raw, msa, mse, ssa, sse, n0, a, N, n_i, balanced, icc, method.

References

Searle, S. R., Casella, G. and McCulloch, C. E. (1992). Variance Components. Wiley, Eq. (21) and Chapters 4-5.

Examples

set.seed(1)
r <- morie_ranova(y = rnorm(10), group = rbinom(10, 1, 0.5)); TRUE
#> [1] TRUE