Dear all,
I am analying a dataset on cancer using Fine and Gray model (stcrreg) and is trying to draw CIF on various cancer types after stcrreg.
Since it is taking a long time for stcrreg to run, I have been tryig to use estimates store/save on cancer type 1 to 13, then restore the estimates and then draw the curves over loop so I can modify how the graphs look without having to re-run the models. However, I have bumped into the issue of stcurve returning "no obseravtions" error after estimates restore/use. The code I am using are as follows.
The code gives me the first graph (i.e. cancercat==1) graph alright, but from the 2nd graph, it gives me "no observations
r(2000);" It is highly inefficient for me and I have been pulling my hair out trying to resolve this.
Appreciate any help in advance.
Best Regards,
Bree
I am analying a dataset on cancer using Fine and Gray model (stcrreg) and is trying to draw CIF on various cancer types after stcrreg.
Since it is taking a long time for stcrreg to run, I have been tryig to use estimates store/save on cancer type 1 to 13, then restore the estimates and then draw the curves over loop so I can modify how the graphs look without having to re-run the models. However, I have bumped into the issue of stcurve returning "no obseravtions" error after estimates restore/use. The code I am using are as follows.
Code:
foreach cat in 1 2 3 4 5 6 7 8 9 10 11 12 13 { use "/Users/breeshi/Desktop/Cancer/Saved dataset/Analysis SET B_step3 Ready for analysis.dta", clear stset bmi_to, failure(cancercat == `cat') id(id) origin(bmi_from) scale(365.25) replace failuretype=5 if cancercat~=. & cancercat~=`cat' stcrreg i.obese_vary , compete(failuretype==2 3 5) local title `:label (cancercat) `cat'' estimates store cancercat`cat' estimates save `"cancercat`cat'"',replace } foreach cat in 1 2 3 4 5 6 7 8 9 10 11 12 13 { estimates restore cancercat`cat' stcurve, at(obese_vary=(0 1)) cif ytitle("Cumulative Cancer Incidence",size(small)) /// graphregion(color(white)) title("`title'",size(med)) legend(off) /// xtitle("Years post-transplant",size(small)) lpattern( dash solid) /// lcolor(ebblue orange_red) xlabel(, labsize(small)) ylabel(, labsize(small)) saving("SetB_cancercat_`cat'", replace) }
r(2000);" It is highly inefficient for me and I have been pulling my hair out trying to resolve this.
Appreciate any help in advance.
Best Regards,
Bree
Comment