Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /homepages/19/d22005043/htdocs/persocMain/persoc/cookbook/attachtable/attachtable.php on line 298

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /homepages/19/d22005043/htdocs/persocMain/persoc/cookbook/attachtable/attachtable.php on line 309

Warning: Cannot modify header information - headers already sent by (output started at /homepages/19/d22005043/htdocs/persocMain/persoc/cookbook/attachtable/attachtable.php:298) in /homepages/19/d22005043/htdocs/persocMain/persoc/pmwiki.php on line 1247
persoc - personality and social relationships

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).