Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: duration analysis in gllamm

 From Melaku Fekadu To statalist@hsphsun2.harvard.edu Subject st: duration analysis in gllamm Date Mon, 12 Jul 2010 17:25:21 +0300

```Dear Statalisters,

I want to estimate a duration model (time-to-first-employment) through
gllamm with unobserved heterogeneity. An individual may experience
transition in and out of states through years, as seen in below:  from
unemployment to employment, and from employment to unemployment. But,
I am interested only about the first transition from unemployment
(year 19XX=0) to employment (year 19XX=1).

1. the data structure for gllamm estimation
2. the codes themselves in gllamm

An example of the data is given below.

Variables
Year 1996 =1 if employed in 1996, 0 other wise, and so on
X is some exogenous variable; it may be time-varying variable. In this
example it is not so.

Data – Table 1, (my data currently structured as follows), each
individual has one row of observation with one entry for each year
For the first individual (row vector)
Id=1, year96=0, year97=0, year98=0, year99=0, year2000=1, x=12

For the second individual (row vector)
Id=2, year96=1, year97=1, year98=1, year99=0, year2000=0, x=15

For the third individual (row vector)
Id=3, year96=0, year97=0, year98=0, year99=0, year2000=0, x=10

For the fourth individual (row vector)
Id=4, year96=0, year97=0, year98=0, year99=1, year2000=1, x=8

For the fifth individual (row vector)
Id=5, year96=1, year97=1, year98=1, year99=1, year2000=1, x=17

Restructured data (Table 2)
For the first individual – 5 rows of observation for each year
Id=1, Event=0, x=12
Id=1, Event=0, x=12
Id=1, Event=0, x=12
Id=1, Event=1, x=12
Id=1, Event=1, x=12

For the second individual – 5 rows of observation for each year
Id=2, Event=1, x=15
Id=2, Event=1, x=15
Id=2, Event=1, x=15
Id=2, Event=0, x=15
Id=2, Event=0, x=15

For the third individual – 5 rows of observation for each year
Id=3, Event=0, x=10
Id=3, Event=0, x=10
Id=3, Event=0, x=10
Id=3, Event=0, x=10
Id=3, Event=0, x=10

For the fourth individual – 5 rows of observation for each year
Id=4, Event=0, x=8
Id=4, Event=0, x=8
Id=4, Event=0, x=8
Id=4, Event=1, x=8
Id=4, Event=0, x=8

For the fifth individual – 5 rows of observation for each year
Id=5, Event=1, x=17
Id=5, Event=1, x=17
Id=5, Event=1, x=17
Id=5, Event=1, x=17
Id=5, Event=1, x=17

Questions:

1.       If I want to use stata's gllamm, should I convert my data from that
of Table 1 to Table 2?

2.       Should I discard observations collected after the first transition
to employment has occurred? For example:  In case of individual number one,
observation 5 should be thrown? For individual number 2 (which is left
censored, because he is already observed working in the first period), which
observations should be thrown? Individual 3 is right-censored (has not yet
experienced employment at all), so should all of his observations remain in
the data? For individual 4, observation no 20 is collected after he has
already experienced employment in the previous period, so should it be
thrown? Individual 5 is left censored, so should his observations remain in
the data or be thrown?
3.       If the data is to be restructured, for estimation through gllamm,
should the dependent variable be binary (one employed, 0 otherwise)? Or,
should it be a variable that indicates how many years has passed until the
individual became employed? For example: individual 1 is employed in the
fourth year from the beginning of the observation, so the variable takes the
value of 4; for individual 2, the variable takes value of 1 (since he is
already employed in the first observation)? And so on.
4.        How should look like a code in gllamm unobserved heterogeneity
(parametric and non-parametric)? I will be grateful if you can indicate me
on how to code this in gllamm.
5.  I would be very grateful if you have some codes of gllamm which would
give me some hints on how to code it.

I really appreciate any help.

Thanks a lot

*
*   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/
```