  # st: -gllamm- questions on mixed logit model

 From "Daniel Mueller" To "Statalist" Subject st: -gllamm- questions on mixed logit model Date Wed, 9 Feb 2005 18:33:19 +0100

```I have problems estimating a mixed logit model (also called random
parameters model or error components model) including fixed effects
using -gllamm-. For the statistical part and the code I attempted to
follow the GLAMM Manual and Skrondal & Rabe-Hesketh (2004).

I want to introduce two random coefficients, named rc1 and rc2. The
dependent variable (depvar) has five unordered categories (therefore
-link(mlogit) fam(binom)-). I have two 'levels' in the model, let's say
school and pupil and I expect significant effects between schools and
not within. Therefore, I want to include fixed effects on level 2
(school).

// The following works and is equal to -mlogit depvar var1 var2 rc1 rc2,
cluster(school)-:
gllamm depvar var1 var2 rc1 rc2, i(school) init base(3) link(mlogit)
fam(binom)

// Now, I expand the data:
sort school pupil
gen patt = _n
expand 5
bys patt: gen alt = _n
gen chosen = alt == pupil

// equations for random intercepts
tab alt, gen(a)
eq rceq1: rc1
eq rceq2: rc2

// interactions
gen a2_rc1=a2*rc1
gen a3_rc1=a3*rc1
<omitted>
gen a5_rc2=a5*rc2

// two random coefficients (rc1 & rc2) for dependence over pupils:
// fixed effects with -cluster(school)-:
gllamm alt var1 var2 a2_rc1 a3_rc1 <omitted> a5_rc2, ///
nocons i(pupil) eq(rceq1 rceq2) nrf(2) expand(patt chosen o) ///

I have several questions :
1. Is the above the correct procedure to estimate such a model (the code
seems to work also for my (much more complicated data structure), but I
am not sure if I am doing the right thing)? Is the clustering the
correct procedure to incorporate fixed effects for schools?

2. What is the correct full name for this model?

3. Estimating that on my own data I receive the error:
could not calculate numerical derivatives
flat or discontinuous region encountered
(error occurred in ML computation)
(use trace option and check correctness of initial model)

The data is 'fine'. How can I 'check correctness of initial model'??

4. Can differnet points in time (i.e. 5 years) be included? If yes, as
another level?

Thanks a lot in advance for any help!

Greetings,
Daniel

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```