问题
I assume that the random effects variances in my mixed effect model will be different for different levels of the fixed factor BTyp
.
Here is my model
fm2 <- lme(CA ~ 1 + pF+Tiefe+BTyp+Tiefe:pF+BTyp:pF, data=data2,
random = list(~ 1 + pF|Probe))
fm2_Btyphet<-update(fm2, weights=varIdent(form=~1|BTyp))
I managed to incorporate Btyp
-specific variances for random effects using lmer
function, but this function does not allow to consider variance heterogeneity of the within group error (which is better to consider in my case). My question is how to incorporate "Btyp"-specific variances for random effects using lme
function?
Below you can see how it works with lmer
function.
CA ~ 1 + pF + Tiefe + BTyp + Tiefe:pF + BTyp:pF +
(0 + Pind + pF | Probe) + (0 + Bind + pF | Probe) + (0 + Tind + pF | Probe)
Data: data2
AIC BIC logLik deviance REMLdev
21987 22092 -10975 21979 21951
Random effects:
Groups Name Variance Std.Dev. Corr
Probe Pind 158.6058 12.5939
pF 2.4289 1.5585 -1.000
Probe Bind 134.6383 11.6034
pF 2.7619 1.6619 -1.000
Probe Tind 490.6714 22.1511
pF 46.3533 6.8083 -1.000
Residual 316.9860 17.8041
Number of obs: 2530, groups: Probe, 45
Pind
,Bind
, Tind
are indicator variables for different levels of BTyp
.
来源:https://stackoverflow.com/questions/21409340/how-to-allow-for-factor-specific-variance-of-random-effect-in-lme