Hello,
I need help figuring out how to implement step functions in both line and stacked area plots with the CI step function to graph competing event of death prior to the diagnosis of breast cancer. So far I have been able to set up the plot but without the requisite step function using the Aalen Johansen estimator. What I have discovered is the the "stepwise" or "J " option with the "twoway" or "graph tw" commands works well for the first of the requested CI in the combined line plots for the two CIs(attached as graph) but not at all for area plots (attached as graph 1). I need assistance in figuring this out. Instead of the step the plots have diagonal connections linking the points which makes it incorrect. See the code I am using below and the output. Please note that this possible with SAS but I am facile with it. The dataset is also attached.
use bccarecurrence.dta , clear
stset time, failure(status=1)
sts graph, failure
stcompet cif=ci, compet1(2)
gen CI1 = cif if status==1
gen CI2 = cif if status==2
gen ci_d=1-CI2
sort time
replace CI1=0 if _n==1 & CI1==.
replace CI2=0 if _n==1 & CI2==.
replace CI1 = CI1[_n-1] if CI1==.
replace CI2 = CI2[_n-1] if CI2==.
label variable CI "CI of death before Breast CA"
label variable CI1 "CI of Breast CA"
graph tw line CI CI1 time, connect(J) ylab(0 (0.2) 1) xlab(0 (5) 60) ( for graph)
graph tw area CI CI1 time, connect(J) ylab(0 (0.2) 1) xlab(0 (5) 60) ( for graph1)
Thanks
0 Response to Step function for combined line and stacked area plots for competing risks CI functions in stata
Post a Comment