I would like to fit a multinomial multilevel logistic Model. Unfortunately I couldn't find a package that implements this. I tried Stata's gsem but it is very very slow and does not converge. This is why I was wondering if it is possible to estimate contrasting binomial models, combine them and approximate the multinomial-model.

So I came up with an approach but got stuck at the "combining" part. Two questions:

  1. Is my approach correct/doable?
  2. If yes, how do I calculate predictions for the base category

The Data $ D $ has an dependent variable $ y \in \{1,2,3\} $.
I split my data in two subsets: $ D_{1,2} $ and $ D_{1,3} $. Where $D_{1,2}$ consists of all rows with $ y \in \{1,2\};$
$D_{2,3}$ of all where $y \in \{1,3\}$

Now I calculated the model $$ logit(p_i) = \ln\left(\frac{P(Y_i = 1)}{1-P(Y_i = 1)}\right)=\dots $$

With $i \in \{1,2\}$ corresponding to the Dataset $D_{1,i}$ and $\dots$ symbolizes the model-specification. Predicting this model I get predictions $\hat{p_i}$ meaning the likelihood of taking alternative $i$ over $1$.
Denoting $\hat{p_i}$ = pi^ the resulting Data-Set would look as follows:

y  p2^  p3^
1  0.2  0.1
1  0.7  0.8
2  0.6  .
3  .    0.1 

This leads to my second question:
If I want to predict $\hat y$, what do I have to do? And how do I calculate the probability of p1^ meaning the likelihood of taking 1 over 2 & 3.

I am thankful for any help!


2 Answers 2


Before giving up on the existing estimator I would first try to estimate the model with gsem after centering all your explanatory/independent/right-hand-side/x-variables. A multilevel model includes an extra model for the intercept (a normal distribution). You can imagine that estimating such a thing is a lot easier when the intercept is a quantity that can actually occur within your data.

If you want to investigate an alternative estimator you can look into:

Peter Haan and Arne Uhlendorf (2006) "Estimation of multinomial logit models with unobserved heterogeneity using maximum simulated likelihood" The Stata Journal, 6(2): 229-245. http://www.stata-journal.com/article.html?article=st0104

  • $\begingroup$ Hi Maarten, thank you very much for your answer. Unfortunatly my explanatory variables are all categorical (some ordered) as well as the latent variables (which form the levels). So as far as i know centering them is appropriate, is it? $\endgroup$
    – Rentrop
    Aug 20, 2014 at 13:53
  • $\begingroup$ You want the value 0 to mean something and be within (close) to the range of the data. With categorical variables that is usually not a problem (it is the baseline category). So those variables you don't need to center, though you might want to choose your baseline category to be one that is not too small. $\endgroup$ Aug 20, 2014 at 15:38
  • $\begingroup$ I always made the lagrest category my baseline category, for the dependent as well as the independent categories... Still gsem is very very slow (15k rows, 1 explanatory with 5 categories, 10 categories at 1st level, 95 at second level)... It did perform ~ 30 iterations within 12h. I am going to look into the article now. $\endgroup$
    – Rentrop
    Aug 20, 2014 at 15:43

I used gsem to fit a multilevel multinomial logistic and worked perfectly. I use the MP version so this helps a lot. The hardest model took about 45 to run. The trick I used was to specify the option difficult, this savind about 10-15% of computing time. Another option is to change the integration method and the number of integration points. You may want to define starting levels as well. The manual has a lot of examples and you will surely find it helpful.

  • 2
    $\begingroup$ Welcome to the site. The connection between your answer & the OP's explicit questions ('is this OK' & 'how to calculate predictions') is tenuous. OTOH, your answer seems to be about how fast the algorithm is. Can you draw out the connection more clearly? $\endgroup$ Mar 2, 2015 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.