How do you decided whether to use a variable as fixed effect or random effect in mixed logit model?

Here, I am trying to estimate mixed logit model for discrete Choice data. X1 x2 and x3 are same for individual. They are like demographic variables. And x4, x5 and x6 varies for individual and varies by choice given. pid uniquely represent each survey respondent and gid uniquely represents each choice set.

mixlogit y x1 x2 x3, group(gid) id(pid) rand(x4 x5 x6 price) robust nrep(500) burn(25) difficult tech (nr 5 dfp 5)

In this model above I am confused how to decide which variables to use as fixed effect and which variables to use as random effects. Your suggestions are highly appreciated.

  • 1
    $\begingroup$ Read the book by Kenneth Train on Discrete Choice Methods ... there is a chapter on mixed logit models. It is written in a very accessible style. $\endgroup$ Feb 18 at 14:57
  • $\begingroup$ Thank you. I will so for sure. $\endgroup$ Feb 18 at 15:19

1 Answer 1


In a mixed logit model, the coefficients of the logit model $\beta = (\beta_1,...,\beta_K)$ are assumed to be random variables. Consider, for simplicity the case where there are only two coefficients $K=2$.

In the logit model the choice probability for alternative $j$ from the choice set $j \in \{1,...,J\}$ is given as

$$P_j = \frac{\exp(\beta_{1j} + \beta_{2j} x_1)}{\sum_{s=1}^J \exp(\beta_{1s} + \beta_{2s} x_1)}.$$

The model therefore has relatively many parameters $J * K$. Because choice alternatives are identified relative to each other only $(J-1)*K$ parameters are identified.

In the mixed logit model, the coefficients are assumed to be random. This implies that any coefficient $\beta_{kj}$ can be written as

$$\beta_{kj} = \mu_{kj}+\sigma_{kj}z_{kj},$$

where $z_{kj}$ is the normalized draw from the relevant distribution. So if it is assumed coefficients are normally distributed then $z_{kj} \sim \mathcal N(0,1)$.

The parameters to be estimated now include the parameters of the distribution of $\beta_{kj}$ which will include the location $\mu_{kj}$ and scale $\sigma_{kj}$.

Here comes the really important part: Notice that

$$\beta_{jk}x_{k} = \mu_{kj}x_k + \sigma_{kj} z_{kj} x_k,$$

now $\sigma_{kj}$ is estimated and if it is not significantly different from 0 you can assume that $\sigma_{kj}=0$ and hence

$$\beta_{jk}x_{k} = \mu_{kj}x_k$$

which means the coefficient is non-random.

So one answer is that you should simply assume all coefficients are random and test whether it is the case.

Now, in practice, it can be very hard to estimate mixed logit models due to the many parameters being empirically unidentified. This makes it hard to test for all parameters whether they should be random or not.

It is therefore very often seen in applied cases where coefficients are assumed to be normally distributed that the covariances are assumed to be 0.

Furthermore, even in cases where the covariances are 0 still, the model can be hard to estimate. So here certain coefficients are chosen to be non-random by design. This should be based on interpretation and will therefore be context dependent - depending on the context the model is used to model.

Very often random coefficients are used to describe taste variation across individuals. Individual's preferences for certain alternatives are assumed to depend on $x_k$ and how it depends on $x_k$ varies from one individual to another.

For example, how much strawberry flavor ice cream type $j$ contains measured by $x_j$ will affect the choice of ice cream type $j$ differently from one individual to another. For some, it may be bad for some a good.

So in this case, if you do not believe different individuals have different preferences - some like strawberry some do not - then simply make the term non-random.

Also, note that taste variation can be modeled with observed variables by including interaction terms. Here the part $\sigma_{kj} z_{kj} x_k$ becomes an interaction term where $z_{kj}$ is observed. Hence, the coefficients are only assumed random where there is an assumption that there exists unobserved taste variation left when all observed taste variations have been included. This obviously depends on data availability.


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.