[R-sig-ME] Separating random effects variance for two groups
Stephen T
stwebvanuatu at yahoo.com.au
Thu May 30 13:37:58 CEST 2013
Hello (again),
Is it possible to separate random effects between groups?
I have heteroscedastic models, because variance in the group SEXM (males) is greater than in the group SEXF (females). The residual plots have improved.
Here's an example:
model=lme(MH11~SEX,
random=~1|BIRD/NIGHT, data=calls, weights=varIdent(form=~1|SEX))
...
Random effects:
Formula: ~1 | BIRD
(Intercept)
StdDev: 32.77675
Formula: ~1 | NIGHT %in% BIRD
(Intercept) Residual
StdDev: 22.54168 36.82237
Variance function:
Structure: Different standard deviations per stratum
Formula: ~1 | SEX
Parameter estimates:
M F
1.0000000 0.5704416
...
I have extracted the residuals(model), ranef(model, level1) and ranef(model, level2) from the above and computed sds for groups SEXF and SEXM. It appears that the Variance function ratio result is only for the residuals:
i.e. Residual^2 ~ sdSEXM^2 + sdSEXF^2 = sdSEXM^2(1 + ratio^2)
where sds are computed from residuals(model)
For random effects, BIRD and NIGHT, the ratio of sdSEXF and sdSEXM is often wide of the Variance function result.
What I would really like to check is whether the random effects variances for the group BIRD (i.e. different subject) differs between groups SEXF and SEXM. The biological question is: are individual signatures encoded differently in females and males?
What I'm thinking of now is to run two models, for groups SEXF and SEXM. Then I can compare confidence intervals for the random effects. Separate models would also remove the need for weights. Trying to dissect the above output or modify seems more difficult.
Any corrections, suggestions?
Stephen.
More information about the R-sig-mixed-models
mailing list