Hello,
I need some help to figure out how to handle late entry for my analysis.
Respondents become at risk of the event (moving out of their current neighborhood) in 2005, and all censored in 2014.
However, there are some respondents who started being at risk after 2005 (e.g. 2007). For example,
Here is my code to handle late entry.
"fyear" is the first year a respondent showed up in the data. For example, for A100, fyear=2005 and for B200, fyear=2007.
So a respondent becomes at risk in "fyear" and first entered in "fyear".
Then I run a cox regression.
"lag_incensus" is one of the main predictors. I don't have any covariates yet.
I just wonder if my code is correctly handling late entry.
I would appreciate any of your advice.
Thanks!
I need some help to figure out how to handle late entry for my analysis.
Respondents become at risk of the event (moving out of their current neighborhood) in 2005, and all censored in 2014.
However, there are some respondents who started being at risk after 2005 (e.g. 2007). For example,
ID | Yearid | Moved |
A100 | 2005 | 0 |
A100 | 2006 | 0 |
A100 | 2007 | 0 |
A100 | 2008 | 0 |
A100 | 2009 | 1 |
B200 | 2007 | 0 |
B200 | 2008 | 0 |
B200 | 2009 | 1 |
... | ... | ... |
Code:
stset yearid, failure(moved==1) id(hh_id) origin(fyear) enter(fyear)
So a respondent becomes at risk in "fyear" and first entered in "fyear".
Then I run a cox regression.
Code:
stcox lag_incensus, nohr
I just wonder if my code is correctly handling late entry.
I would appreciate any of your advice.
Thanks!
Comment