[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: event history analysis with years clustered in individuals

From   Austin Nichols <>
Subject   Re: st: event history analysis with years clustered in individuals
Date   Fri, 13 Feb 2009 11:38:08 -0500

Hilde Karlsen <>:
Attrition from nursing sounds like a survival model, probably in
discrete time, using -logit- or -cloglog- with time dummies, not
-xtmelogit- (see for a textbook
and self-guided course on discrete time survival models).  If you have
T years of data on each individual, all of whom are first-year nurses
in period 1, and some of whom quit nursing in each of the subsequent
years, with a variable nurse==1 when a nurse (and zero otherwise), an
individual identifier id, a year variable year, and a bunch of
explanatory variables x*, you can just:

tsset id year
bys id (year): g quit=(l.nurse==1 & nurse==0)
by id: replace quit=. if l.quit==1 | (mi(l.quit)&_n>1)
tab year, gen(_t)
drop _t1
logit quit _t* x*

and then work up to more complicated models with heterogeneous
frailty, etc. The main issues are that someone who quit nursing last
year cannot quit nursing again this year, and people who never quit
nursing might at some future point that you don't observe, which is
why you use survival models...

If you know the day they started work and the day they quit, you might
prefer a continuous-time model (help st).

I've been assuming you had data on people working as nurses, but
rereading your email, maybe you have data on breastfeeding mothers,
though I suppose the same considerations apply (though with multiple
years of data on breastfeeding mothers, there is probably no

On Fri, Feb 13, 2009 at 9:19 AM, Hilde Karlsen <> wrote:
> Dear statalisters,
> This is probably a stupid question, but I've been searching around the nets
> and in books and articles, and I've still not grasped the concept: When I'm
> performing a multilevel analysis of attrition from nursing using xtmelogit,
> and time (year) is the level 1 variable and individuals (id) is the level 2
> variable (i.e. years are clustered within individuals; I have a person-year
> file), how do I formulate the expectation related to this model? Why is it
> important to separate between these two levels?
> I find it more intuitive to grasp the fact that individuals are clustered
> within schools, and that variables on the school level - as well as
> variables on the individual level - may influence e.g. which grades a
> student gets.
> I understand (at least I hope I understand) the point that when the same
> individuals are followed over a period of time,  the individual's responses
> are probably highly correlated, and that this  implies a violation to the
> assumption about the heteroskedastic error-terms. As I see it, I could have
> used the cluster() - command (cluster(id))to 'avoid' this violation;
> however, I have to write an essay using multilevel analysis, so this is not
> an option.
> I don't know if I'm being clear enough about what my problem is, but any
> information regarding this topic (how to grasp the concept of years
> clustered in individuals) will be greatly appreciated.
> I'm really sorry for having to ask you such an infantile question.. My
> colleagues and friends are not familiar with multilevel analyses, so I don't
> know who to turn to.
> Best regards,
> Hilde
*   For searches and help try:

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