Bookmark and Share

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

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

st: Incorporating time varying variable into discrete time model

From   <>
To   <>
Subject   st: Incorporating time varying variable into discrete time model
Date   Wed, 16 Feb 2011 10:01:41 -0000


Date: Tue, 15 Feb 2011 13:44:41 -1000
From: Mike <>
Subject: st: Incorporating time varying variable into discrete time

Hi all:

There are discussions about Cox model about integrating time varying
variables into a continous time model , but seem not any on discrete
time model. I would like to ask whether you know something about that.
For example, if "age at migration" is a time varying variable, since
the age increases as the duration increases. But then how to caputre
such varying effects in the model.
I have already expanded data with the following commands:
ge id=_n;
lab var id "subject identifier";
*qui list id migmonth;
expand migmonth;
bysort id: ge seqvar=_n;
lab var seqvar "spell month identifier, by subject";
bysort id: ge returnee=mig==3 & _n==_N;
lab var returnee "binary depvar for discrete hazard model";
ge logd=ln(seqvar);
ge seqvar2=seqvar^2;
ge seqvar3=seqvar^3;
lab var logd "ln(t)";
ltable migmonth rom;
ltable migmonth rom,graph title("Survivor function,migration
ltable migmonth rom,hazard;
My current estimation commad(without the time-varying variables) is:
pgmhaz logd age marriage sex yedu hhsize num_16 wage_occup log_gdp
num_rm_v num_rm_h job_ch_mig, id(id) s(seqvar) d(returnee);


You have already "expanded" the data so that there is one record in your
data set for each time-interval that the person is at risk of
experiencing the event. Any time-varying variable can be matched in to
each time interval, as appropriate.  (The assumption is that the
variable is constant /within/ each interval, but can vary /between/ each
interval.)   There is discussion of this in the survival analysis
materials at my webpages (URL below).

If age is collinear with elapsed time at risk (duration), then you'll
find it hard to identify their separate effects. How can one tell the
effects apart?

You are using -pgmhaz-. I suggest you update to -pgmhaz8- (-ssc install

Stephen P. Jenkins <>
Department of Social Policy and STICERD
London School of Economics and Political Science
Houghton Street
London WC2A 2AE
United Kingdom
Tel: +44(0)20 7955 6527
Survival Analysis Using Stata:
Downloadable papers and software:

Please access the attached hyperlink for an important electronic communications disclaimer:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index