I am doing a survival analysis to estimate the risk of child abuse (yes or no) for children in foster care as a function of placement setting (group home, foster home, other home). Hazard curves suggests there is a time varying effect of setting on the event. For example, in group homes the risk of abuse is high early in the placement but then starts to drop over time.
I am trying to introduce an interaction term to account for this time-varying effect.
I first set the data:
Then split the data into these time intervals: 0 - 1 months, 2 - 3 months, 4 - 7 months, and 8 months or more.
I then calculated the lag of duration as follows:
I then tried to introduce the interaction like below:
I was trying to make the reference group "Other home in 0 - 1 months," but the interaction term I used assigned the base to *all* settings in 0 - 1 months (0#grouphome = base, 0#fosterhome = base, and 0#otherhome = base). Further, for the subsequent intervals it assigned "Own home" as the base.
Any suggestions on how to change the interaction term?
Thank you.
I am trying to introduce an interaction term to account for this time-varying effect.
I first set the data:
Code:
stset duration_months, failure(abuse==1) id(placement_id)
Code:
stsplit interval, at(1,3,8)
Code:
generate lag_exposure = ln(_t - _t0)
Code:
mepoisson _d ib0.interval##ib3.setting i.gender i.race i.age_at_placement, offset(lag_exposure) irr allbaselevels || child_id:
Any suggestions on how to change the interaction term?
Thank you.
