Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: Estimating a mixed logit model with mixlogit

 From Tunga Kantarcı To statalist@hsphsun2.harvard.edu Subject st: Estimating a mixed logit model with mixlogit Date Fri, 24 Jun 2011 20:54:02 +0200

```Hello,

I would like to sketch a discrete response model and ask if I can make
use of the mixlogit package. Actually I asked in a previous thread a
similar question and Arne Hole replied my question but I now realize
that I should elaborate more on my model because it is still not clear
to me if I can estimate my model with mixlogit, or with any other
Stata package I am not aware of. The model is as follows.

In an online survey, I provide three retirement scenarios (early,
normal and delayed retirement) where each scenario describes the labor
force and work and retirement income trajectory of a hypothetical
person at each age from 60  to 80. For example, from age 60 to 65, a
hypothetical person is working full-time and from 66 onward he is
fully retired. At each age the corresponding hypothetical work and
retirement income is indicated. I ask the respondent to choose among
the "three" retirement scenarios the one he likes the best. I want to
model the choice as follows.

V_is = U_is + E_is

is a random utility model where E_is is assumed to be iid normal.

U_is = sum operator_{t=60}^{80} rho^(t-60) * U_its

is the total life cycle utility from retirement scenario s where s =
{1,2,3}. rho is the discount rate to be estimated.

U_its = alfa_i^0 + alfa_it^lf * L_its^f + alfa_it^lyf * L_its^f * Y_its^f

is the within period utility: I assume that total utility is

L_its^f is a dummy variable which indicates if respondent i, at age t,
in scenario s, is working full time.
Y_its^f indicates a replacement rate, to indicate retirement income,
which takes a random value among the six predetermined values (I
randomize over sub-samples in the sample). The base category is
working full time and hence omitted.

Alfa coefficients represent preference parameters and they are assumed
to be random and depend on observed and unobserved individual
characteristics in the following way.

alfa_i^0 = beta^0x * X_i + e_i^0
alfa_it^lf = beta^lfx * X_i + beta^lft * t + e_i^lf
alfa_it^lyf = beta^lyfx * X_i + beta^lyft * t + e_i^lyf

Unobserved  e terms are assumed to be iid normal. X_i is a vector of
observed characteristics such as gender, education etc. t is age in
the scenario described to the respondent (takes values from 60 to 80
as defined in U_is).

A respondent will choose, for example, scenario 1 if U_i1 + Ei1 > U_i2
+ Ei2 and if U_i1 + Ei1 > U_i3 + Ei3.
Hence, probability of choosing first scenario is given by
P(S=1|L,Y,X,t,e) = P(E_i2 - E_i1 < U_i1 - U_i2, E_i3 - E_i1 < U_i1 -
U_i3).

Then I write the likelihood function and then that function needs to
be integrated over all possible values of e_i^0, e_i^lf, and e_i^lyf.
This is a three dimensional integral which does not have a closed form
solution and hence needs to be simulated.

My question is the following. I wanted to write a Matlab code to
estimate this model but I have a time constraint and hence wondering
if I can estimate this model with mixlogit. It obviously does not seem
feasible to run the mixlogit syntax right away. I could plug in the
alfa coefficients in U_its and indicate the variables as having random
coefficients in the syntax of mixlogit. However, I am not considering
U_its but U_is. So it looks like I first need to instruct Stata about
U_is. But U_is is a long expression where U_its at each age t is
multiplied by the discount factor rho.

Is there a relatively easy way of estimating this model in Stata, for
example with mixlogit, or shall I give up and program it myself in
Matlab?
In particular, would it be feasible to estimate this model in Stata if
I figure out how to instruct Stata about my utility function U_is?

Thanks,
Tunga
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```