Has Grey's test (to compare cumulative incidence curves) been implemented in Stata? Or, is there an alternative to Grey's test implemented in Stata?
Andrzej
Andrzej
use "http://www.stata-journal.com/software/sj4-2/st0059/prostatecancer.dta",clear label define treatment 0 "0:not" 1 "1:trt" label val treatment treatment stset time,f(status==1) stgrays treatment status _t * with stcrreg -similar test stcrreg i.treatment, compete(status==2/3) stset time,f(status==2) stcrreg i.treatment, compete(status==1 3) stset time,f(status==3) stcrreg i.treatment, compete(status==1/2)
use "http://www.stata-journal.com/software/sj4-2/st0059/prostatecancer.dta",clear label define treatment 0 "0:not" 1 "1:trt" label val treatment treatment stset time,f(status==1) stgrays treatment status _t * Even if the event status is not fully-factored (all levels labeled) the R results, as coded, /// will yield correct results: clonevar status0 = status label val status0 . stgrays treatment status0 _t * with stcrreg -similar test stcrreg i.treatment, compete(status==2/3) stset time,f(status==2) stcrreg i.treatment, compete(status==1 3) stset time,f(status==3) stcrreg i.treatment, compete(status==1/2)
use "http://www.stata-journal.com/software/sj4-2/st0059/prostatecancer.dta",clear label define treatment 0 "0:not" 1 "1:trt" label val treatment treatment stset time,f(status==1) stgrays treatment status _t * with strata - as example * stgrays treatment status _t if !missing(AG),strata(AG) * Even if the event status is not fully-factored (all levels labeled) the R results, as coded, /// will yield correct results: clonevar status0 = status label val status0 . stgrays treatment status0 _t * with stcrreg -similar test stcrreg i.treatment, compete(status==2/3) stset time,f(status==2) stcrreg i.treatment, compete(status==1 3) stset time,f(status==3) stcrreg i.treatment, compete(status==1/2)
di `"`=c(sysdir_personal)'"'
. which stgrays
scalar `sc_stgraydt'="C:\data\stgraydt.dta" // line 12 for working dataset scalar `sc_stgrayR' ="`=c(sysdir_personal)'stgrays.R" // line 13 for path to R program scalar `sc_rpath' ="C:\Users\abuxton\R\R-4.2.3\bin\x64\r" // line 14 for path to R exe
scalar `sc_stgraydt'="C:\data\stgraydt.dta" // line 12 for working dataset scalar `sc_stgrayR' ="`=c(sysdir_personal)'stgrays.R" // line 13 for path to R program scalar `sc_rpath' ="C:\Users\abuxton\R\R-4.2.3\bin\x64\r" // line 14 for path to R exe
frame reset use "http://www.stata-journal.com/software/sj4-2/st0059/prostatecancer.dta",clear label define treatment 0 "0:not" 1 "1:trt" label val treatment treatment stset time,f(status==1) frame copy default dtaA, replace stgrays treatment status _t , at(12(12)60) * with strata - as example *frame copy dtaA default , replace *stgrays treatment status _t if !missing(AG),strata(AG) at(12(12)60) cwf default frame default : use "C:\data\stgraystest.dta" , clear format status %40.0g list , noobs frame default : use "C:\data\stgrayslist.dta" , clear format group_status %40.0g bysort group_status: list time est se lci* uci* if time<=60, noobs frame default : use "C:\data\stgraysplot.dta" , clear drop if time>60 #delimit; twoway (connected est time if inlist(group_status,1), sort connect(stairstep) msymbol(none) lpattern("dash") lcolor(black) lwidth(thin)) (connected est time if inlist(group_status,2), sort connect(stairstep) msymbol(none) lpattern("solid") lcolor(black) lwidth(thin)) (connected est time if inlist(group_status,3), sort connect(stairstep) msymbol(none) lpattern("dash") lcolor(red) lwidth(thin)) (connected est time if inlist(group_status,4), sort connect(stairstep) msymbol(none) lpattern("solid") lcolor(red) lwidth(thin)) (connected est time if inlist(group_status,5), sort connect(stairstep) msymbol(none) lpattern("dash") lcolor(blue) lwidth(thin)) (connected est time if inlist(group_status,6), sort connect(stairstep) msymbol(none) lpattern("solid") lcolor(blue) lwidth(thin)) , xlabel(0(6)60, nogrid labsize(*1.2)) ylabel(0(0.05)0.35, nogrid labsize(*1.2) angle(0)) ytitle("cumulative incidence") xtitle("time to event") graphregion(style(none) margin(medium) fcolor(white) ifcolor(white)) plotregion(style(none) margin(small) ifcolor(white)) title(`""', color(black) size(medium)) legend(label(1 "not Cancer") label(2 "trt Cancer") label(3 "not CVD") label(4 "trt CVD") label(5 "not Other") label(6 "trt Other") rows(2) bm(zero) region(lw(none))) note(`"R cmprsk"') scheme(tufte) ; #delimit cr cwf dtaA
Comment