I assume that the variances of random effects in my mixed effect model will be different for different levels of a fixed coefficient 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 include BTyp-specific variances for random effects using the function lmer, but this function does not allow us to consider the heterogeneity of variance within the group error (which is better to consider in my case). My question is, how do I enable “Btyp” special variances for random effects using a function lme?
Below you can see how this works with the function lmer.
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 BTyp.