I want to fit a multinomial response mixed effects model. I'm using the mblogit function from the mclogit package.
From the help(mblogit) example I can fit a fixed effects model (which is structurally close enough to the real thing I want to fit, but 100 times smaller so that's good).
library(mclogit)
library(MASS) # For 'housing' data
house.mblogit <- mblogit(Sat ~ Infl + Type + Cont, weights = Freq, data=housing)
Printing this out shows the values of the fixed effects parameters:
Predictors
Response categories (Intercept) InflMedium InflHigh TypeApartment
Medium/Low -0.4192 0.4464 0.6649 -0.4357
High/Low -0.1387 0.7349 1.6126 -0.7356
Predictors
Response categories TypeAtrium TypeTerrace ContHigh
Medium/Low 0.1314 -0.6666 0.3609
High/Low -0.4080 -1.4123 0.4818
It's used "Low" as the baseline of the multinomial model and I've got a value for each level of the factors in the model relative to a baseline factor (ie Type has four levels and these are relative to "Tower").
If I try to use Type as a random effect parameter:
house.mblogit.mixed <- mblogit(Sat ~ Infl + Cont, random=~1|Type, weights = Freq, data=housing)
it converges and fits but I can't find the values of the random effect parameters or hyperparameters. The printed value drops the Type from the "Predictors" and adds an extra "(Co-)Variances" table:
Coefficients:
Predictors
Response categories (Intercept) InflMedium InflHigh ContHigh
Medium/Low -0.6910 0.4387 0.6609 0.3680
High/Low -0.7704 0.7341 1.6089 0.4721
(Co-)Variances:
Grouping level: Type
Medium~1 High~1
Medium~1 0.08094
High~1 0.12866 0.23883
What I'm expecting is to find three values (or four?) matched up to the levels of Type - ie Tower, Apartment, Atrium and Terrace - in the way that ranef on an nlme mixed effects model returns values for each level in a random effect factor...
> fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1|Subject)
> head(ranef(fm2))
(Intercept)
M16 -1.7018336
M05 -1.7018336
M02 -1.3776748
...
What am I missing?
[More exploration...]
The returned object has a $random.effects component which seems undocumented. Its essentially a vector in this case but its unclear how that vector maps to combinations of response level and effect factor level.