I want to run a multinomial mixed effects model with the mclogit package of R.
Below can be show the head of my data frame.
> head(mydata)
ID VAR1 X1 Time Y other_X3 other_X4 other_X5 other_X6 other_X7
1 1 1 1 1 10 0 0 0 0 0
2 1 1 1 2 5 1 1 1 0 2
3 2 2 3 1 10 0 0 0 0 0
4 2 2 3 2 7 1 0 0 0 2
5 3 1 3 1 10 0 0 0 0 0
6 3 1 3 2 7 1 0 0 0 2
The Y variable is a categorical variable with 10 levels (1-10, is a score variable). What I want is a model for y~x1+x2 by adding random intercept effect (for ID variable) and random slope effect (for Time variable).
I try the following command by I got an error.
> mixed_model <- mclogit( cbind(Y, ID) ~ X1 + Time + X1*Time,
+ random = list(~1|ID, ~Time|ID), data = mydata)
Error in FUN(X[[i]], ...) :
No predictor variable remains in random part of the model.
Please reconsider your model specification.
In addition: Warning messages:
1: In mclogit(cbind(Y, ID) ~ X1 + Time + X1 * Time, random = list(~1 | :
removing X1 from model due to insufficient within-choice set variance
2: In FUN(X[[i]], ...) : removing intercept from random part of the model
because of insufficient within-choice set variance
Any idea about how to correct it ? Thank you in advance.