Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: gllamm and multinomial logit panel data model

From   Stas Kolenikov <>
Subject   Re: st: gllamm and multinomial logit panel data model
Date   Sun, 26 Sep 2004 21:33:25 -0400

-gllamm- syntax requires some convergence, if I may say so, in the
sense that it never works right the first time you run it :).

The way you specified the model above, -gllamm- would integrate over a
random effect over an individual, not individual-cross-option, as you
must have meant by Aij. In fact, you would have a three level model
here: the first level are options for each individual at each point in
time, the combination of {ijt}; the second level are either individual
and their options over time {ij}, or indviduals at a single instance
over available options {it}; and the third level are individuals per
se {i}. Hence your identifier should have a form of -i(spid pid)-
where the variable -spid- would identify clustered observations that
belong to the same individual and the same sector. Note that this
syntax also implies that there is an individual additive effect to the

The model that will be equivalent to what you have written down is
quite tricky in -gllamm-. First of all, you would need to -expand- (or
-reshape-) your data, so that the structure is as follows: pid as the
top clustering level (let's forget about sampling in clusters.
Besides, you can control for that with -cluster- option of -gllamm- if
you are lucky enough to have your model converged); the next level
will be time slices (indices i and t in your model), and the
individual observations, the ijt things. Look at the help on the
-expanded- option, because that's what you would need to use. Let's
say you have -tid- as the cross-identifier of -pid- and -time-:

egen long tpid = group(pid time)

Then let's code the options by -sector- variable that takes values 1,
2, 3, and the actual responses by -selected- variable, as in Sophia's
example in gllamm.hlp.

Next, you would define your random factors Aij, and for that to
happen, you would need the sectoral dummies, say D1 for private, D2
for public sector, and D3 for unemployed (and may be D4 for out of
labor force -- to be precise, this is what you would need to do). Now,
within each {it} group, you have the format of the data that complies
with the -expanded- option of -gllamm-. The random effects Aij are
shown to -gllamm- as random slopes for variables D1-D3:

eq private : D1
eq public : D2
eq out : D3

and an overall constant may be in place, too, just for the sake of
completenes (I've never seen a multilevel model without one at each

g byte one = 1
eq const : one

Now I think we are ready for the grand finale:

gllamm sector <explanatory vars> , link(mlogit) expanded(tpid selected
o) i(tpid pid) nrf(1 4) eqs(one private public out)

The -eqs- option may have to look like -eqs(one one private public
out)-, depending on whether -gllamm- would assume that the only random
effect at the second level is all it needs.

Keep in mind that you'll get a whole covariance matrix of A's, at
least for the above syntax. It would certainly make sense to restrict
their variance to be constant, and may be to restrict the
off-diagonals to zero, as well. You'd see how to do that once you get
the results out of -gllamm-; it uses Cholesky decomposition for the
covariance matrix, and both restriction would boil down to restricting
the diagnoal values to be equal to each other, and off-diagonals, to
zero. You do that with -constraint- command and pass that to -gllamm-
as -constraint- option.

If that works (which I doubt -- this looks like quite a heavy model
for -gllamm- to handle graciously), I would really appreciate it if
you could send me the data for a hundred or so individuals, so that
-gllamm- would converge within an hour :)).

I'd be curious if Sophia Rabe-Hesketh comments on this, too.


On Mon, 27 Sep 2004 00:24:20 +0200,
<> wrote:
> Hi,
> I want to analize mobility between working in the state sector, working in the private sector and not working in Poland using CHER panel data.
> More precisely I use a multinomial logit panel data model with random effects.
> I assume that individual i (i = 1,...,n) can be in any of three possible labor market states at time t (t = 1994,1995,1996). The utility of state j in time period t for each individual is specified as:
> Uijt = X'it Bj + Z'it Cj + Aij + Eijt
> where:
> Xit is a vector of explanatory variables.
> Zit is a vector of dummy variables indicating the lagged labor market state (two dummies for state sector and not working, private sector is taken as a reference state).
> The vectors Bj and Cj are parameters to be estimated.
> Aij is a random effect reflecting time constant unobserved heterogeneity (it is assumed to follow a multivariate normal distribution and to be independent of the Xit and Zit).
> The Eijt are i.i.d. error terms.
> I want to estimate such a model using Stata and I think I need to use
> gllaam. I have tried:
> gllamm depvar varlist, i(pid) link(mlogit) basecategory(1)
> where:
> pid is the person identifier and 1 denotes working in the private sector.
> I have noticed that I obtain the same results if I use:
> mlogit depvar varlist, basecategory(1)
> What do I do wrong? Do I have to define the equations for the random effect? Could someone help me learn how to estimate this model in Stata?Any help and suggestions would be very much appreciated.
> Sebastian
> *
> *   For searches and help try:
> *
> *
> *

Stas Kolenikov
*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index