Calculation of variance components in a half-block design with R
Variance components can be estimated with a multi-level model. In R, this can be done with the lme4-package by calculating an intercept-only model with two random effects (one for actor variance, one for partner variance) with following syntax:
lmer(y ~ 1 + (1|actor) + (1|partner), data=dat)
This is a sample output:
Linear mixed model fit by REML Formula: y ~ 1 + (1 | actor) + (1 | partner) Data: re2 AIC BIC logLik deviance REMLdev 4295 4320 -2144 4283 4287 Random effects: Groups Name Variance Std.Dev. actor (Intercept) 0.1201 0.3465 partner (Intercept) 0.3421 0.5848 Residual 0.4300 0.6557 Number of obs: 600, groups: actor, 60; partner, 10
In this example, 60 participants rated 10 stimuli. Variance components are estimated as 0.12 (actor), 0.34 (partner) and 0.43 (relationship + error).