| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: multiple record hazard data
Hi,
I'm having a little trouble getting my data in the right format for hazard
modeling.
In the past, I've just created one record per spell myself, but I thought
I would take advantage of Stata's facility for multiple records.
I have data on involvement in special education as follows.
Individuals do enter, exit and sometimes return to special education.
+------------------------+
| newid timeg iep |
| 10068 0 0 |
| 10068 1 1 |
| 10068 2 1 |
| 10068 3 1 |
| 10068 4 1 |
| 10068 5 0 |
| 10068 6 0 |
| 10068 7 0 |
| 10068 8 0 |
| 10068 9 1 |
| 10068 10 1 |
-timeg- is essentially grade (with 0 equaling kindergarten).
I'm conceptualizing the time point as the end of the given grade.
Individuals become at risk at the end of kindergarten (time 0).
-iep- is the indicator for involvement in special education. You can see
that this individual entered special education, left at the end of 4th
grade, then eventually returned (when they went to high school).
stset timeg, id(newid) failure(iep==1) enter(iep==0) exit(iep==.)
For now, I'm treating individuals lost to followup (iep=.) as censored.
I know individuals are not at risk of entering special education when they
are in special education (e.g., 2nd grade above).
To help stata out, I added the following before I -stset-
bys newid (timeg): drop if iep==iep[_n-1]
Combined with the -stset-, these commands give me something close to what
I want.
+----------------------------------------------+
| newid timeg newiep _st _d _t _t0 |
|----------------------------------------------|
| 10068 0 0 0 . . . |
| 10068 1 1 1 1 1 0 |
| 10068 5 0 1 0 5 1 | <<<< no!
| 10068 9 1 1 1 9 5 |
Still, The problem involves that record for timeg=5
Stata treats the time the individual was *in* special education as yet
another spell (censored, in this case).
How do I get around this problem? What am I doing wrong?
thanks,
michael
*
* 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/