This is my test post
-
Login or Register
- Log in with
use C:\follic.dta,clear tabstat dftime,by(evcen0) stats(n p50 min max) gen byte a=cond(!missing(age),cond(age>65,1,0),.) label define a 0 "0:age<=65" 1 "1:age >65",modify label val a a label var a `"a: age >65 years"' tabstat age,by(a) stats(n p50 min max) stset dftime,failure(evcen0==1 2) sts test a stpepemori a,compet(3) recode evcen0 (1/2=1 "1:fail disease") (3=2 "2:death cmp ev") (0=0 "0:censored"),gen(evntcode) stgrays a evntcode _t stgrays a evcen0 _t tabstat dftime if _d==1,by(a) stats(n p50 min max) stcompet ci=ci se=se lo=lo hi=hi,compet1(3) by(a) gen double cifail=ci clonevar cifail0=cifail clonevar cifail1=cifail cifill cifail0 if a==0 cifill cifail1 if a==1 cilist,at(0(2)10 12(6)30 32) sep(6) by(a) drop ci se lo hi /*death without disease failure*/ stset dftime,failure(evcen0==3) sts test a stpepemori a,compet(1/2) tabstat dftime if _d==1,by(a) stats(n p50 min max) stcompet ci=ci se=se lo=lo hi=hi,compet1(1) compet2(2) by(a) gen double cidth=ci clonevar cidth0=cifail clonevar cidth1=cifail cifill cidth0 if a==0 cifill cidth1 if a==1 cilist,at(0(2)10 12(6)30 32) sep(6) by(a) drop ci se lo hi #delimit ; stset dftime,failure(evcen0==1 2); twoway (connected cifail0 _t , sort connect(stairstep) msymbol(none) lpattern("--") lcolor(gs3) lwidth(thin)) (connected cifail1 _t , sort connect(stairstep) msymbol(none) lpattern("--") lcolor(gs10) lwidth(thin)) , xlabel(0(6)32, nogrid labsize(*1.2)) ylabel(0(0.1)1.00, nogrid labsize(*1.2) angle(0)) ytitle("cumulative incidence") xtitle("time to disease failure (years)") graphregion(style(none) margin(medium) fcolor(white) ifcolor(white)) plotregion(style(none) margin(zero) ifcolor(white)) title(`"CIFs for disease failure figure 5.3 page 83"', color(black) size(medium)) legend(label(1 "age <65 years") label(2 ">=65 years") rows(1) bm(zero) region(lw(none))) scheme(sj) ; graph save C:\follic_pg083_fig53.gph,`replace'; #delimit cr #delimit ; stset dftime,failure(evcen0==3); twoway (connected cidth0 _t , sort connect(stairstep) msymbol(none) lpattern("--") lcolor(gs3) lwidth(thin)) (connected cidth1 _t , sort connect(stairstep) msymbol(none) lpattern("--") lcolor(gs10) lwidth(thin)) , xlabel(0(6)32, nogrid labsize(*1.2)) ylabel(0(0.1)1.00, nogrid labsize(*1.2) angle(0)) ytitle("cumulative incidence") xtitle("time to death without disease failure (years)") graphregion(style(none) margin(medium) fcolor(white) ifcolor(white)) plotregion(style(none) margin(zero) ifcolor(white)) title(`"CIFs for competing risk figure 5.4 page 83"', color(black) size(medium)) legend(label(1 "age <65 years") label(2 ">=65 years") rows(1) bm(zero) region(lw(none))) scheme(sj) ; graph save C:\follic_pg083_fig54.gph,`replace'; #delimit cr
. use C:\dtapintilie\follic.dta,clear . . tabstat dftime,by(evcen0) stats(n p50 min max) Summary for variables: dftime by categories of: evcen0 evcen0 | N p50 min max ---------+---------------------------------------- 0:cens | 193 10.3217 1.09514 31.10198 1:noresp | 24 .0027379 .0027379 .0027379 2:rlps | 248 2.409309 .1505818 23.3922 3:dead | 76 7.206023 .7173169 29.66735 ---------+---------------------------------------- Total | 541 5.46475 .0027379 31.10198 -------------------------------------------------- . . gen byte a=cond(!missing(age),cond(age>65,1,0),.) . label define a 0 "0:age<=65" 1 "1:age >65",modify . label val a a . label var a `"a: age >65 years"' . . tabstat age,by(a) stats(n p50 min max) Summary for variables: age by categories of: a (a: age >65 years) a | N p50 min max ----------+---------------------------------------- 0:age<=65 | 382 53.25 17 65 1:age >65 | 159 72 65.2 86 ----------+---------------------------------------- Total | 541 58 17 86 --------------------------------------------------- . . stset dftime,failure(evcen0==1 2) failure event: evcen0 == 1 2 obs. time interval: (0, dftime] exit on or before: failure ------------------------------------------------------------------------------ 541 total observations 0 exclusions ------------------------------------------------------------------------------ 541 observations remaining, representing 272 failures in single-record/single-failure data 4000.041 total analysis time at risk and under observation at risk from t = 0 earliest observed entry t = 0 last observed exit t = 31.10198 . sts test a failure _d: evcen0 == 1 2 analysis time _t: dftime Log-rank test for equality of survivor functions | Events Events a | observed expected ----------+------------------------- 0:age<=65 | 188 206.40 1:age >65 | 84 65.60 ----------+------------------------- Total | 272 272.00 chi2(1) = 6.94 Pr>chi2 = 0.0084 . stpepemori a,compet(3) Pepe and Mori test comparing the cumulative incidence of two groups of a Main event failure: evcen0 == 1 2 Chi2(1) = 2.6174 - p = 0.1057 Competing event failure: evcen0 == 3 Chi2(1) = 17.767 - p = 0.00002 . recode evcen0 (1/2=1 "1:fail disease") (3=2 "2:death cmp ev") (0=0 "0:censored"),gen(evntcode) (324 differences between evcen0 and evntcode) . stgrays a evntcode _t Beginning of R output from source file: C:\ado\personal\stgrays.R group status t 0:age<=65:382 censored :193 Min. : 0.002738 1:age >65:159 1:fail disease:272 1st Qu.: 1.919233 2:death cmp ev: 76 Median : 5.464750 Mean : 7.393791 3rd Qu.:10.850103 Max. :31.101985 grp fstatus 0:age<=65 1:age >65 censored 157 36 1:fail disease 188 84 2:death cmp ev 37 39 fstatus censored 1:fail disease 2:death cmp ev 193 272 76 grp 0:age<=65 1:age >65 382 159 [1] 541 stat pv df 1:fail disease 2.632 0.105 1 2:death cmp ev 39.347 0 1 Tests: stat pv df 1:fail disease 2.631747 1.047464e-01 1 2:death cmp ev 39.347029 3.547923e-10 1 Estimates and Variances: $est 5 10 15 20 25 30 0:age<=65 1:fail disease 0.35195 0.4705 0.52700 0.5548 0.5676 0.5676 1:age >65 1:fail disease 0.43919 0.5414 0.57191 0.5719 NA NA 0:age<=65 2:death cmp ev 0.02631 0.0483 0.08347 0.1246 0.1563 0.3258 1:age >65 2:death cmp ev 0.11607 0.2122 0.30365 0.3285 NA NA $var 5 10 15 20 25 0:age<=65 1:fail disease 6.021e-04 0.000731 0.0008055 0.0009010 0.001013 1:age >65 1:fail disease 1.593e-03 0.001799 0.0018576 0.0018576 NA 0:age<=65 2:death cmp ev 6.767e-05 0.000133 0.0002740 0.0005139 0.000943 1:age >65 2:death cmp ev 6.697e-04 0.001283 0.0018782 0.0023043 NA 30 0:age<=65 1:fail disease 0.001013 1:age >65 1:fail disease NA 0:age<=65 2:death cmp ev 0.012360 1:age >65 2:death cmp ev NA End of R output from source file: C:\ado\personal\stgrays.R . stgrays a evcen0 _t Beginning of R output from source file: C:\ado\personal\stgrays.R group status t 0:age<=65:382 censored:193 Min. : 0.002738 1:age >65:159 1:noresp: 24 1st Qu.: 1.919233 2:rlps :248 Median : 5.464750 3:dead : 76 Mean : 7.393791 3rd Qu.:10.850103 Max. :31.101985 grp fstatus 0:age<=65 1:age >65 censored 157 36 1:noresp 10 14 2:rlps 178 70 3:dead 37 39 fstatus censored 1:noresp 2:rlps 3:dead 193 24 248 76 grp 0:age<=65 1:age >65 382 159 [1] 541 stat pv df 1:noresp 10.119 0.001 1 2:rlps 0.003 0.957 1 3:dead 39.347 0 1 Tests: stat pv df 1:noresp 10.119173432 1.467348e-03 1 2:rlps 0.002870895 9.572692e-01 1 3:dead 39.347029144 3.547923e-10 1 Estimates and Variances: $est 5 10 15 20 25 30 0:age<=65 1:noresp 0.02618 0.02618 0.02618 0.02618 0.02618 0.02618 1:age >65 1:noresp 0.08805 0.08805 0.08805 0.08805 NA NA 0:age<=65 2:rlps 0.32578 0.44431 0.50082 0.52863 0.54145 0.54145 1:age >65 2:rlps 0.35114 0.45340 0.48386 0.48386 NA NA 0:age<=65 3:dead 0.02631 0.04830 0.08347 0.12463 0.15626 0.32578 1:age >65 3:dead 0.11607 0.21218 0.30365 0.32854 NA NA $var 5 10 15 20 25 30 0:age<=65 1:noresp 6.691e-05 6.691e-05 6.691e-05 6.691e-05 6.691e-05 6.691e-05 1:age >65 1:noresp 5.082e-04 5.082e-04 5.082e-04 5.082e-04 NA NA 0:age<=65 2:rlps 5.800e-04 7.252e-04 8.074e-04 9.067e-04 1.020e-03 1.020e-03 1:age >65 2:rlps 1.476e-03 1.796e-03 1.889e-03 1.889e-03 NA NA 0:age<=65 3:dead 6.767e-05 1.330e-04 2.740e-04 5.139e-04 9.430e-04 1.236e-02 1:age >65 3:dead 6.697e-04 1.283e-03 1.878e-03 2.304e-03 NA NA End of R output from source file: C:\ado\personal\stgrays.R . . tabstat dftime if _d==1,by(a) stats(n p50 min max) Summary for variables: dftime by categories of: a (a: age >65 years) a | N p50 min max ----------+---------------------------------------- 0:age<=65 | 188 2.361396 .0027379 23.3922 1:age >65 | 84 1.895962 .0027379 10.9514 ----------+---------------------------------------- Total | 272 2.116359 .0027379 23.3922 --------------------------------------------------- . stcompet ci=ci se=se lo=lo hi=hi,compet1(3) by(a) . gen double cifail=ci (193 missing values generated) . clonevar cifail0=cifail (193 missing values generated) . clonevar cifail1=cifail (193 missing values generated) . cifill cifail0 if a==0 . cifill cifail1 if a==1 . cilist,at(0(2)10 12(6)30 32) sep(6) by(a) 0 1 -> a = 0:age<=65 +---------------------------------------------------+ | point time ci se lo hi | |---------------------------------------------------| | 0 0.00 0.0262 0.0082 0.0134 0.0460 | | 2 1.99 0.2173 0.0211 0.1774 0.2599 | | 4 3.97 0.3276 0.0240 0.2810 0.3749 | | 6 5.98 0.3805 0.0250 0.3315 0.4293 | | 8 7.96 0.4219 0.0259 0.3709 0.4720 | | 10 9.77 0.4705 0.0270 0.4168 0.5223 | |---------------------------------------------------| | 12 11.94 0.4991 0.0276 0.4439 0.5518 | | 18 17.94 0.5391 0.0288 0.4809 0.5937 | | 24 23.88 0.5676 0.0316 0.5033 0.6269 | | 30 29.67 0.5676 0.0316 0.5033 0.6269 | | 32 31.10 0.5676 0.0316 0.5033 0.6269 | +---------------------------------------------------+ -> a = 1:age >65 +---------------------------------------------------+ | point time ci se lo hi | |---------------------------------------------------| | 0 0.00 0.0881 0.0225 0.0505 0.1384 | | 2 1.96 0.2837 0.0358 0.2159 0.3552 | | 4 3.97 0.4054 0.0391 0.3284 0.4808 | | 6 5.95 0.4538 0.0400 0.3741 0.5299 | | 8 7.66 0.5130 0.0414 0.4291 0.5907 | | 10 9.92 0.5414 0.0421 0.4555 0.6196 | |---------------------------------------------------| | 12 11.88 0.5719 0.0426 0.4839 0.6504 | | 18 16.25 0.5719 0.0426 0.4839 0.6504 | | 24 22.00 0.5719 0.0426 0.4839 0.6504 | | 30 22.00 0.5719 0.0426 0.4839 0.6504 | | 32 22.00 0.5719 0.0426 0.4839 0.6504 | +---------------------------------------------------+ . drop ci se lo hi . . /*death without disease failure*/ . stset dftime,failure(evcen0==3) failure event: evcen0 == 3 obs. time interval: (0, dftime] exit on or before: failure ------------------------------------------------------------------------------ 541 total observations 0 exclusions ------------------------------------------------------------------------------ 541 observations remaining, representing 76 failures in single-record/single-failure data 4000.041 total analysis time at risk and under observation at risk from t = 0 earliest observed entry t = 0 last observed exit t = 31.10198 . sts test a failure _d: evcen0 == 3 analysis time _t: dftime Log-rank test for equality of survivor functions | Events Events a | observed expected ----------+------------------------- 0:age<=65 | 37 62.99 1:age >65 | 39 13.01 ----------+------------------------- Total | 76 76.00 chi2(1) = 66.14 Pr>chi2 = 0.0000 . stpepemori a,compet(1/2) Pepe and Mori test comparing the cumulative incidence of two groups of a Main event failure: evcen0 == 3 Chi2(1) = 17.767 - p = 0.00002 Competing event failure: evcen0 == 1 2 Chi2(1) = 2.6174 - p = 0.1057 . tabstat dftime if _d==1,by(a) stats(n p50 min max) Summary for variables: dftime by categories of: a (a: age >65 years) a | N p50 min max ----------+---------------------------------------- 0:age<=65 | 37 10.97604 .8980151 29.66735 1:age >65 | 39 5.629021 .7173169 21.26489 ----------+---------------------------------------- Total | 76 7.206023 .7173169 29.66735 --------------------------------------------------- . stcompet ci=ci se=se lo=lo hi=hi,compet1(1) compet2(2) by(a) . gen double cidth=ci (193 missing values generated) . clonevar cidth0=cifail (193 missing values generated) . clonevar cidth1=cifail (193 missing values generated) . cifill cidth0 if a==0 . cifill cidth1 if a==1 . cilist,at(0(2)10 12(6)30 32) sep(6) by(a) 0 1 -> a = 0:age<=65 +---------------------------------------------------+ | point time ci se lo hi | |---------------------------------------------------| | 0 0.00 0.0000 0.0000 0.0000 0.0000 | | 2 1.99 0.0079 0.0045 0.0022 0.0215 | | 4 3.97 0.0236 0.0078 0.0117 0.0427 | | 6 5.98 0.0321 0.0091 0.0175 0.0537 | | 8 7.96 0.0446 0.0109 0.0265 0.0696 | | 10 9.77 0.0483 0.0115 0.0292 0.0745 | |---------------------------------------------------| | 12 11.94 0.0646 0.0139 0.0410 0.0954 | | 18 17.94 0.1025 0.0194 0.0685 0.1443 | | 24 23.88 0.1246 0.0225 0.0847 0.1726 | | 30 29.67 0.3258 0.0814 0.1762 0.4845 | | 32 31.10 0.3258 0.0814 0.1762 0.4845 | +---------------------------------------------------+ -> a = 1:age >65 +---------------------------------------------------+ | point time ci se lo hi | |---------------------------------------------------| | 0 0.00 0.0000 0.0000 0.0000 0.0000 | | 2 1.96 0.0506 0.0174 0.0237 0.0925 | | 4 3.97 0.0959 0.0236 0.0562 0.1482 | | 6 5.95 0.1393 0.0283 0.0895 0.1998 | | 8 7.66 0.1746 0.0321 0.1170 0.2418 | | 10 9.92 0.2122 0.0355 0.1473 0.2851 | |---------------------------------------------------| | 12 11.88 0.2754 0.0401 0.2001 0.3557 | | 18 16.25 0.3285 0.0461 0.2406 0.4191 | | 24 22.00 0.3783 0.0539 0.2737 0.4823 | | 30 22.00 0.3783 0.0539 0.2737 0.4823 | | 32 22.00 0.3783 0.0539 0.2737 0.4823 | +---------------------------------------------------+ . drop ci se lo hi . . #delimit ; delimiter now ; . stset dftime,failure(evcen0==1 2); failure event: evcen0 == 1 2 obs. time interval: (0, dftime] exit on or before: failure ------------------------------------------------------------------------------ 541 total observations 0 exclusions ------------------------------------------------------------------------------ 541 observations remaining, representing 272 failures in single-record/single-failure data 4000.041 total analysis time at risk and under observation at risk from t = 0 earliest observed entry t = 0 last observed exit t = 31.10198 . twoway > (connected cifail0 _t , sort connect(stairstep) msymbol(none) lpattern("--") lcolor(gs3) lwidth(thin)) > (connected cifail1 _t , sort connect(stairstep) msymbol(none) lpattern("--") lcolor(gs10) lwidth(thin)) > , > xlabel(0(6)32, nogrid labsize(*1.2)) > ylabel(0(0.1)1.00, nogrid labsize(*1.2) angle(0)) > ytitle("cumulative incidence") > xtitle("time to disease failure (years)") > graphregion(style(none) margin(medium) fcolor(white) ifcolor(white)) > plotregion(style(none) margin(zero) ifcolor(white)) > title(`"CIFs for disease failure figure 5.3 page 83"', color(black) size(medium)) > legend(label(1 "age <65 years") label(2 ">=65 years") > rows(1) bm(zero) region(lw(none))) > scheme(sj) > ; . graph save C:\follic_pg083_fig53.gph,`replace'; (file C:\follic_pg083_fig53.gph saved) . #delimit cr delimiter now cr . . #delimit ; delimiter now ; . stset dftime,failure(evcen0==3); failure event: evcen0 == 3 obs. time interval: (0, dftime] exit on or before: failure ------------------------------------------------------------------------------ 541 total observations 0 exclusions ------------------------------------------------------------------------------ 541 observations remaining, representing 76 failures in single-record/single-failure data 4000.041 total analysis time at risk and under observation at risk from t = 0 earliest observed entry t = 0 last observed exit t = 31.10198 . twoway > (connected cidth0 _t , sort connect(stairstep) msymbol(none) lpattern("--") lcolor(gs3) lwidth(thin)) > (connected cidth1 _t , sort connect(stairstep) msymbol(none) lpattern("--") lcolor(gs10) lwidth(thin)) > , > xlabel(0(6)32, nogrid labsize(*1.2)) > ylabel(0(0.1)1.00, nogrid labsize(*1.2) angle(0)) > ytitle("cumulative incidence") > xtitle("time to death without disease failure (years)") > graphregion(style(none) margin(medium) fcolor(white) ifcolor(white)) > plotregion(style(none) margin(zero) ifcolor(white)) > title(`"CIFs for competing risk figure 5.4 page 83"', color(black) size(medium)) > legend(label(1 "age <65 years") label(2 ">=65 years") > rows(1) bm(zero) region(lw(none))) > scheme(sj) > ; . graph save C:\follic_pg083_fig54.gph,`replace'; (file C:\follic_pg083_fig54.gph saved) . #delimit cr delimiter now cr .
Comment