0
votes

I am trying to extract the Level 3 random effects of a 3-level hierarchical regression i run with lmer. The problem is, my dataset is imputed (Plausible Values) and I am trying to extract ONLY the L3 random effects to pool with MItools. I can extract them on a regular lmer model with only one PV

m0 <- lmer(PV4MATH ~ 1 + (1 | SCHOOLID) + (1 | CNT), data = pisa, REML = F)

ranef(m0)$CNT

But I fail when trying to extract exactly those from a model I fit with mitools on all PVs and then try to pool them with MIcombine

model0<-with(mis, lmer(MATH ~ 1 + (1 | SCHOOLID) + (1 | CNT), REML = F))

I would like to only extract the L 2 random effects ( = the means for all countries while controlling for individual level variables, I know that this is an empty model). This is how I can extract all of the ranefs, but then I have a problem with MIcombine.

betas<-MIextract(model0, , fun = ranef)

I tried a kinds of combinations of $CNT, but it does not work. Does anyone have an idea? I get an error telling me its a non-numeric operation for a binary operator (not sure if this is the correct translation). I have no problems with the fixed effects.

1

1 Answers

0
votes

Found a solution... Just in case someone needs to do that too:

betas2 <- list()

for ( i in 1:5){ betas2[[i]] <- betas[[i]]$CNT 

}

Extract all the coefficients in the list "manually" and then you can use them. Works for variances as well.