Hi!
I am using piecewise exponential survival methods to model the progression to a first birth among women who have initiated sexual activity -- left truncating in the month of first sexual intercourse or age 10 (whichever comes later), and right censoring in the month before first birth, study attrition, or their 24th birthday (whichever comes first). I specify age dependence by splitting each individual’s history into 16 episodes, using stsplit. My model also includes a piecewise constant specification for months since first intercourse (0-7, 7-14, 14-36, and 36+), as well as a linear specification of age at onset as a right-hand covariate. I use svy commands.
Here are some excerpts from the code:
(I can also use Poisson models to run the regressions if post-estimation possibilities are greater.)
Many, many thanks for any advice!
Rachel
I am using piecewise exponential survival methods to model the progression to a first birth among women who have initiated sexual activity -- left truncating in the month of first sexual intercourse or age 10 (whichever comes later), and right censoring in the month before first birth, study attrition, or their 24th birthday (whichever comes first). I specify age dependence by splitting each individual’s history into 16 episodes, using stsplit. My model also includes a piecewise constant specification for months since first intercourse (0-7, 7-14, 14-36, and 36+), as well as a linear specification of age at onset as a right-hand covariate. I use svy commands.
Here are some excerpts from the code:
stset firstbirthdate_surv_mo [pweight=GSWGT1], failure(birth) id(aid) origin(time dateage10_mo) enter(time datefirstsex_mo_nsfgmo) exit(birth==1 time dateage24_mo)I then use streg. For example:
stsplit age, at(60 66 72 78 84 90 96 102 108 120 126 132 138 144 150) after (time=dateage10_mo) //max is 168
gen mo0_59 = age==0
gen mo60_65 = age==60
gen mo66_71 = age==66
gen mo72_77 = age==72
gen mo78_83 = age==78
gen mo84_89 = age==84
gen mo90_95 = age==90
gen mo96_101 = age==96
gen mo102_107 = age==102
gen mo108_119 = age==108
gen mo120_125 = age==120
gen mo126_131 = age==126
gen mo132_137 = age==132
gen mo138_143 = age==138
gen mo144_149 = age==144
gen mo150_168 = age==150
stsplit durat, at(8 15 37) after(time=datefirstsex_mo_alt)
gen mo0_7 = durat==0
gen mo8_14 = durat==8
gen mo15_36 = durat==15
gen mo37_168 = durat==37
stsplit postmar, after(firstmarriagedate_mo) at(0)
replace postmar = postmar + 1
gen exposure = _t - _t0
gen events = _d
gen lexposure=ln(exposure)
stset exposure [pweight=GSWGT1], failure(events)
svy, subpop(analyticsample4_postw1): streg b0.age b3.immigrantgen i.race_ethnicity2 w1age firstsex_imputed_nsfgmo agefirstsex_mo_nsfgmo b15.durat postmar b3.parentaled, distribution(exponential)I am writing because I am trying to come up with predictions by immigrant generation of the % of women experiencing a first birth by a particular age (say, 120 months after age 10=20 years). Are “margins” commands appropriate to use to this end with piecewise constant models? If so, what might the command look like? If not, what other commands might be appropriate?
(I can also use Poisson models to run the regressions if post-estimation possibilities are greater.)
Many, many thanks for any advice!
Rachel