if (spaMM.getOption("example_maxtime")>1.1) {
## data preparation
data("wafers")
me <- fitme(y ~ 1+(1|batch), family=Gamma(log), data=wafers, fixed=list(lambda=0.2))
set.seed(123)
wafers$y1 <- simulate(me, type="marginal")
wafers$y2 <- simulate(me, type="marginal")
## fits
(fitmv1 <- fitmv(
submodels=list(mod1=list(formula=y1~X1+(mv(1,2)|batch), family=Gamma(log)),
mod2=list(formula=y2~X1+(mv(1,2)|batch), family=Gamma(log))),
data=wafers))
# alternative '0+' parametrization of the same model:
(fitmv2 <- fitmv(
submodels=list(mod1=list(formula=y1~X1+(0+mv(1,2)|batch), family=Gamma(log)),
mod2=list(formula=y2~X1+(0+mv(1,2)|batch), family=Gamma(log))),
data=wafers))
# relationship between the *correlated* effects of the two fits
ranef(fitmv2)[[1]][,2]-rowSums(ranef(fitmv1)[[1]]) # ~ 0
# fit with given correlation parameter:
update(fitmv2, fixed=list(ranCoefs=list("1"=c(NA,-0.5,NA))))
}
Run the code above in your browser using DataLab