Sorry, try this link.
-
Login or Register
- Log in with
range timevar_new 0 10 100 predict s1_new, meansurv (at sex 1) timevar(timevar_new)
mi predictnl survimp2 = predict(survival at(agegrp 2) timevar(_t)) using mi_stpm2
line survimp2 _t if stage==1
standsurv, at1(var1 0) at2(var1 1) ci contrast(ratio) hazard contrastvar(hratio_var1) timevar(_t)
mi predictnl hrimp = predict(hr hrnum(var1 1) timevar(_t) ) using mi_stpm2 , ci(lci uci) force
set more off use http://pauldickman.com/data/colon.dta, clear stset surv_mm, failure(status=1 2) scale(12) exit(time 10*12) gen _age = min(int(age + _t),99) gen _year = int(yydx + mmdx/12 + _t) merge m:1 _year sex _age using http://pauldickman.com/data/popmort keep if _merge==3 replace stage=. if stage==0 sts gen H=na gen timevar = . replace timevar = 1 in 1 replace timevar = 2 in 2 replace timevar = 3 in 3 replace timevar = 4 in 4 replace timevar = 5 in 5 replace timevar = 6 in 6 replace timevar = 7 in 7 replace timevar = 8 in 8 replace timevar = 9 in 9 replace timevar = 10 in 10 mi set flong mi register imputed stage set seed 29390 mi impute chained (mlogit) stage = i.subsite sex i.agegrp H _d, add(10) tab(agegrp),gen(agegrp) tab(stage),gen(stage) mi estimate, dots cmdok sav(mi_stpm2,replace): /// stpm2 stage1 sex, df(5) bhaz(rate) scale(hazard) nolog /// tvc(stage1) dftvc(stage1:2) mi predictnl hrimp = predict(hr hrnum(stage1 1) hrdenom(stage1 0) timevar(timevar)) using mi_stpm2, ci(mill miul) force /*output here is: option hr not allowed predict(hr hrnum(stage1 1) hrdenom(stage1 0) timevar(timevar)) invalid */ // compare predictions to first imputation stpm2 stage1 sex if _mi_m==1, df(5) bhaz(rate) scale(hazard) nolog /// tvc(stage1) dftvc(stage1:2) //using predict predict hrcc if _mi_m==1, hrnum(stage1 1) hrdenom(stage1 0) timevar(timevar) ci //using standsurv standsurv if _mi_m==1, at1(stage1 0 ) at2(stage1 1) ci contrast(ratio) hazard contrastvar(hratio_stage1) timevar(timevar) list timevar hrcc hrcc_lci hrcc_uci hratio_stage1 hratio_stage1_lci hratio_stage1_uci if inlist(timevar,1,2,3,4,5,6,7,8,9,10) & _mi_m==1 /*output here shows that standsurv and predict would give nearly identical results: | timevar hrcc hrcc_lci hrcc_uci hratio_~1 hrati~lci hrati~uci | |---------------------------------------------------------------------------------| 15565. | 1 .10844999 .09978368 .11786898 .10849877 .09983011 .11792017 | 15566. | 2 .15890791 .14671461 .17211458 .15901694 .14681975 .17222743 | 15567. | 3 .21908062 .19810078 .24228233 .21925888 .19826885 .24247105 | 15568. | 4 .29510389 .25943194 .33568075 .29536435 .25966927 .33596621 | 15569. | 5 .3795031 .32253015 .44653997 .37985286 .32283667 .44693868 | |---------------------------------------------------------------------------------| 15570. | 6 .46547052 .38154234 .56786045 .46591051 .3819134 .56838174 | 15571. | 7 .54522721 .43228679 .68767477 .54575086 .43271411 .68831589 | 15572. | 8 .61209619 .47285049 .79234717 .61269039 .47332405 .79309198 | 15573. | 9 .66226365 .50314812 .87169787 .66291154 .50365777 .87252045 | 15574. | 10 .69521221 .5241272 .92214259 .69589645 .52466367 .92301392 | +---------------------------------------------------------------------------------+ */
mi predictnl survimp2 = predict(survival at(agegrp 2) timevar(_t)) using mi_stpm2, ci(surv_ll surv_ul) force
Comment