Dear All,
I am estimating a competing risk survival model for outcome of interest Y, with time varying covariates and a competing risk of death (captured using indicator 'dead'). Here is a dataex of my data:
[CODE]
. stset stop, id(ID) enter(start) failure(d2=1) time0(start)
Survival-time data settings
ID variable: ID
Failure event: d2==1
Observed time interval: (start, stop]
Enter on or after: time start
Exit on or before: failure
--------------------------------------------------------------------------
6,956 total observations
0 exclusions
--------------------------------------------------------------------------
6,956 observations remaining, representing
264 subjects
45 failures in single-failure-per-subject data
6,956 total analysis time at risk and under observation
At risk from t = 0
Earliest observed entry t = 0
Last observed exit t = 31
.
. foreach tvc in x1 x2 z1 z2 z3 z4 z5 COVID {
2. gen `tvc'tvc=`tvc'*(_t)
3. }
. dataex date ID Female age80plus x1 x2 z1 z2 z3 z4 z5 z1tvc z2tvc z3tvc z4tvc z5tvc COVIDtvc start Y dead COVID d t0 failtime stop _st _d _t _t0
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
Listed 100 out of 6956 observations
Use the count() option to list more
.
. stcrreg Female age80plus c.z1 c.z2 c.z3 c.z4 c.z5 c.COVID c.z1tvc c.z2tvc c.z3tvc c.z4tvc c.z5tvc c.COVIDtvc, compete(d2=2) vce(cluster ID)
Failure _d: d2==1
Analysis time _t: stop
Enter on or after: time start
ID variable: ID
Iteration 0: Log pseudolikelihood = -239.52031
Iteration 1: Log pseudolikelihood = -239.12838
Iteration 2: Log pseudolikelihood = -239.12643
Iteration 3: Log pseudolikelihood = -239.12643
Competing-risks regression No. of obs = 6,956
No. of subjects = 264
Failure event: d2 == 1 No. failed = 45
Competing event: d2 == 2 No. competing = 30
No. censored = 189
Wald chi2(14) = 34.12
Log pseudolikelihood = -239.12643 Prob > chi2 = 0.0020
(Std. err. adjusted for 264 clusters in ID)
------------------------------------------------------------------------------
| Robust
_t | SHR std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
Female | 1.085202 .3453661 0.26 0.797 .5815878 2.024911
age80plus | 1.692023 .5487433 1.62 0.105 .8960896 3.194928
z1 | .3194986 .5694249 -0.64 0.522 .0097145 10.50798
z2 | .9999984 2.06e-06 -0.76 0.449 .9999944 1.000002
z3 | 1.004033 .0166543 0.24 0.808 .9719164 1.037212
z4 | .8690125 .0892814 -1.37 0.172 .710517 1.062864
z5 | 1.011105 .0622987 0.18 0.858 .8960861 1.140887
COVID | 7.85115 27.61417 0.59 0.558 .007963 7740.894
z1tvc | 1.037434 .1078434 0.35 0.724 .8462067 1.271876
z2tvc | .9999998 1.87e-07 -0.89 0.373 .9999995 1
z3tvc | .9998533 .0008061 -0.18 0.856 .9982748 1.001434
z4tvc | 1.006519 .005446 1.20 0.230 .9959014 1.01725
z5tvc | .9999654 .0019668 -0.02 0.986 .9961179 1.003828
COVIDtvc | .9690446 .1599352 -0.19 0.849 .7012258 1.339151
------------------------------------------------------------------------------
. stcurve, cif at(COVID=(0 1)) legend(label(1 "W/o COVID-19 infection") label(2 "With COVID-19 infection") pos(6) cols(2)) lcolor(navy khaki)
note: function evaluated at specified values of selected covariates and overall means of other covariates (if any).
.
. stcompet cif=ci hi=hi low=lo, compet1(2) by(COVID)
. gen ci_case=cif if d2==1 & COVID==1
(6,953 missing values generated)
. gen lo_case=low if d2==1 & COVID==1
(6,953 missing values generated)
. gen hi_case=hi if d2==1 & COVID==1
(6,953 missing values generated)
. sort _t
.
. gen ci_case0=cif if d2==1 & COVID==0
(6,914 missing values generated)
. gen lo_case0=low if d2==1 & COVID==0
(6,914 missing values generated)
. gen hi_case0=hi if d2==1 & COVID==0
(6,914 missing values generated)
. sort _t
.
. gen ci_casedead=cif if d2==2 & COVID==1
(6,955 missing values generated)
. gen lo_casedead=low if d2==2 & COVID==1
(6,955 missing values generated)
. gen hi_casedead=hi if d2==2 & COVID==1
(6,955 missing values generated)
.
. gen ci_casedead0=cif if d2==2 & COVID==0
(6,927 missing values generated)
. gen lo_casedead0=low if d2==2 & COVID==0
(6,927 missing values generated)
. gen hi_casedead0=hi if d2==2 & COVID==0
(6,927 missing values generated)
.
.
. # delimit ;
delimiter now ;
. twoway
> (rarea hi_case lo_case _t if inrange(_t, 9,31), color(gs12%35))
> (line ci_case _t if inrange(_t, 9,31), mcolor(black) lwidth(medsmall))
> (rarea hi_case0 lo_case0 _t if inrange(_t, 8,31), color(ebblue%35))
> (line ci_case0 _t if inrange(_t, 9,31), mcolor(navy) lwidth(medsmall))
> (rarea hi_casedead lo_casedead _t if inrange(_t, 8,31), color(midgreen%35))
> (line ci_casedead _t if inrange(_t, 8,31), mcolor(green) lwidth(medsmall))
> (rarea hi_casedead0 lo_casedead0 _t if inrange(_t, 8,31), color(gs12%35))
> (line ci_casedead0 _t if inrange(_t, 8,31), mcolor(black) lwidth(medsmall)),
> name(`Y'_`g', replace)
> ;
[CODE]
I would prefer to just put 95% Confidence interval bands on the stcurve generated graph. But, the only way I could put CI bands on the cumulative incidence function graph was using the user written stcompet function, the output of which (also attached) is strange, or perhaps I am doing something wrong? I would be grateful for any guidance on how to put CI on the stcurve plots.
Many thanks in advance.
Sincerely,
Sumedha

I am estimating a competing risk survival model for outcome of interest Y, with time varying covariates and a competing risk of death (captured using indicator 'dead'). Here is a dataex of my data:
[CODE]
. stset stop, id(ID) enter(start) failure(d2=1) time0(start)
Survival-time data settings
ID variable: ID
Failure event: d2==1
Observed time interval: (start, stop]
Enter on or after: time start
Exit on or before: failure
--------------------------------------------------------------------------
6,956 total observations
0 exclusions
--------------------------------------------------------------------------
6,956 observations remaining, representing
264 subjects
45 failures in single-failure-per-subject data
6,956 total analysis time at risk and under observation
At risk from t = 0
Earliest observed entry t = 0
Last observed exit t = 31
.
. foreach tvc in x1 x2 z1 z2 z3 z4 z5 COVID {
2. gen `tvc'tvc=`tvc'*(_t)
3. }
. dataex date ID Female age80plus x1 x2 z1 z2 z3 z4 z5 z1tvc z2tvc z3tvc z4tvc z5tvc COVIDtvc start Y dead COVID d t0 failtime stop _st _d _t _t0
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(date ID) byte(Female age80plus) float(x1 x2 z1) double z2 float(z3 z4 z5) double(z1tvc z2tvc z3tvc z4tvc z5tvc COVIDtvc start Y dead COVID d t0 failtime) float stop byte(_st _d _t _t0) 714 130 0 0 0 0 0 300814 0 0 0 0 300814 0 0 0 0 0 0 . 0 0 0 31 1 1 0 1 0 715 130 0 0 0 0 0 311590 0 0 0 0 623180 0 0 0 0 1 0 . 0 0 0 31 2 1 0 2 1 716 130 0 0 0 0 0 328555 0 0 0 0 985665 0 0 0 0 2 0 . 0 0 0 31 3 1 0 3 2 717 130 0 0 0 0 0 315154 0 0 0 0 1260616 0 0 0 0 3 0 . 0 0 0 31 4 1 0 4 3 718 130 0 0 0 0 0 303275 0 0 0 0 1516375 0 0 0 0 4 0 . 0 0 0 31 5 1 0 5 4 719 130 0 0 0 0 0 330590 0 0 0 0 1983540 0 0 0 0 5 0 . 0 0 0 31 6 1 0 6 5 720 130 0 0 0 0 0 330541 0 0 0 0 2313787 0 0 0 0 6 0 . 0 0 0 31 7 1 0 7 6 721 130 0 0 0 0 0 305320 0 0 0 0 2442560 0 0 0 0 7 0 . 0 0 0 31 8 1 0 8 7 722 130 0 0 0 0 0 222244 .4656787 .4656787 0 0 2000196 4.191107958555222 4.191107958555222 0 0 8 0 . 0 0 0 31 9 1 0 9 8 723 130 0 0 0 0 .4333333 151294 5.205984 4.740305 0 4.333333373069763 1512940 52.05983638763428 47.40304946899414 0 0 9 0 . 0 0 0 31 10 1 0 10 9 724 130 0 0 0 0 1.4333333 163006 10.735918 5.529934 0 15.766666054725647 1793066 118.0950984954834 60.82927846908569 0 0 10 0 . 0 0 0 31 11 1 0 11 10 725 130 0 0 0 0 1.4333333 166896 15.395236 4.6593175 0 17.19999933242798 2002752 184.7428321838379 55.91180992126465 0 0 11 0 . 0 0 0 31 12 1 0 12 11 726 130 0 0 0 0 1.4333333 167821 23.339613 7.944377 0 18.63333261013031 2181673 303.4149684906006 103.27690029144287 0 0 12 0 . 0 0 0 31 13 1 0 13 12 727 130 0 0 0 0 1.4333333 170337 32.951828 9.612215 0 20.06666588783264 2384718 461.3255920410156 134.5710105895996 0 0 13 0 . 0 0 0 31 14 1 0 14 13 728 130 0 0 0 0 1.4333333 169772 40.23565 7.283822 0 21.499999165534973 2546580 603.5347366333008 109.25733089447021 0 0 14 0 . 0 0 0 31 15 1 0 15 14 729 130 0 0 0 0 1.4333333 172300 44.69756 4.4619102 0 22.933332443237305 2756800 715.1609497070313 71.39056396484375 0 0 15 0 . 0 0 0 31 16 1 0 16 15 730 130 0 0 0 0 1.4333333 164305 48.61533 3.917775 0 24.366665720939636 2793185 826.4606704711914 66.60217356681824 0 0 16 0 . 0 0 0 31 17 1 0 17 16 731 130 0 0 0 0 1.4333333 185252 65.713844 17.098507 .8503267 25.799998998641968 3334536 1182.8491973876953 307.7731246948242 15.305880904197693 0 17 0 . 0 0 0 31 18 1 0 18 17 732 130 0 0 0 0 1.4333333 175118 103.58314 37.869293 8.691729 27.2333322763443 3327242 1968.0796127319336 719.5165710449219 165.14284324645996 0 18 0 . 0 0 0 31 19 1 0 19 18 733 130 0 0 0 0 1.4333333 168116 132.14392 28.56078 22.32485 28.66666555404663 3362320 2642.87841796875 571.2156295776367 446.49696350097656 0 19 0 . 0 0 0 31 20 1 0 20 19 734 130 0 0 0 0 1.4333333 156651 149.97891 17.834988 46.12095 30.099998831748962 3289671 3149.557159423828 374.53474044799805 968.539924621582 0 20 0 . 0 0 0 31 21 1 0 21 20 735 130 0 0 0 0 1.4333333 170931 156.29594 6.317033 76.4915 31.533332109451294 3760482 3438.510772705078 138.97472190856934 1682.8130187988281 0 21 0 . 0 0 0 31 22 1 0 22 21 736 130 0 0 0 0 1.4333333 219019 160.07452 3.7785776 97.18011 32.966665387153625 5037437 3681.7140502929688 86.90728402137756 2235.142463684082 0 22 0 . 0 0 0 31 23 1 0 23 22 737 130 0 0 0 0 1.4333333 201108 161.11977 1.0452461 107.9263 34.39999866485596 4826592 3866.8743896484375 25.085906982421875 2590.2313842773438 0 23 0 . 0 0 0 31 24 1 0 24 23 738 130 0 0 0 0 1.4333333 225788 163.03056 1.910801 114.24239 35.83333194255829 5644700 4075.7640838623047 47.77002930641174 2856.0596466064453 0 24 0 . 0 0 0 31 25 1 0 25 24 739 130 0 0 0 0 1.4333333 220645 166.6902 3.659627 121.51273 37.26666522026062 5736770 4333.94482421875 95.15030097961426 3159.3308715820313 0 25 0 . 0 0 0 31 26 1 0 26 25 740 130 0 0 0 0 1.4333333 218961 175.3331 8.642895 128.16202 38.69999849796295 5911947 4733.993270874023 233.35815811157227 3460.374481201172 0 26 0 . 0 0 0 31 27 1 0 27 26 741 130 0 0 0 0 1.4333333 214934 182.58653 7.253452 137.43388 40.13333177566528 6018152 5112.422912597656 203.0966510772705 3848.1487426757813 0 27 0 . 0 0 0 31 28 1 0 28 27 742 130 0 0 0 0 1.4333333 209142 188.9795 6.392958 150.83334 41.566665053367615 6065118 5480.4052734375 185.39578676223755 4374.166961669922 0 28 0 . 0 0 0 31 29 1 0 29 28 743 130 0 0 0 0 1.4333333 219563 194.13992 5.160429 165.9968 42.999998331069946 6586890 5824.197692871094 154.81285572052002 4979.904327392578 0 29 0 . 0 0 0 31 30 1 0 30 29 744 130 0 0 0 0 1.4333333 0 203.14473 9.004808 175.3703 44.43333160877228 0 6297.486618041992 279.14906120300293 5436.47883605957 0 30 0 0 0 0 0 31 31 1 0 31 30 714 194 0 0 0 0 0 66339 0 0 0 0 66339 0 0 0 0 0 1 . 0 0 0 20 1 1 0 1 0 715 194 0 0 0 0 0 66523 0 0 0 0 133046 0 0 0 0 1 1 . 0 0 0 20 2 1 0 2 1 716 194 0 0 0 0 0 66176 0 0 0 0 198528 0 0 0 0 2 1 . 0 0 0 20 3 1 0 3 2 717 194 0 0 0 0 0 63046 0 0 0 0 252184 0 0 0 0 3 1 . 0 0 0 20 4 1 0 4 3 718 194 0 0 0 0 0 62767 0 0 0 0 313835 0 0 0 0 4 1 . 0 0 0 20 5 1 0 5 4 719 194 0 0 0 0 0 71338 0 0 0 0 428028 0 0 0 0 5 1 . 0 0 0 20 6 1 0 6 5 720 194 0 0 0 0 0 83189 0 0 0 0 582323 0 0 0 0 6 1 . 0 0 0 20 7 1 0 7 6 721 194 0 0 0 0 0 70688 0 0 0 0 565504 0 0 0 0 7 1 . 0 0 0 20 8 1 0 8 7 722 194 0 0 0 0 0 54859 .4293737 .4293737 0 0 493731 3.864363133907318 3.864363133907318 0 0 8 1 . 0 0 0 20 9 1 0 9 8 723 194 0 0 0 0 .23333333 42059 5.427283 4.99791 0 2.333333343267441 420590 54.2728328704834 49.97910022735596 0 0 9 1 . 0 0 0 20 10 1 0 10 9 724 194 0 0 0 0 .23333333 45153 10.20192 4.774635 0 2.566666677594185 496683 112.2211046218872 52.52098846435547 0 0 10 1 . 0 0 0 20 11 1 0 11 10 725 194 0 0 0 0 .23333333 49831 13.619734 3.4178145 0 2.800000011920929 597972 163.43680572509766 41.013773918151855 0 0 11 1 . 0 0 0 20 12 1 0 12 11 726 194 0 0 0 0 .23333333 50417 16.195976 2.576242 0 3.033333346247673 655421 210.54769134521484 33.491148710250854 0 0 12 1 . 0 0 0 20 13 1 0 13 12 727 194 0 0 0 0 .23333333 51892 19.44204 3.246065 0 3.266666680574417 726488 272.1885795593262 45.44491195678711 0 0 13 1 . 0 0 0 20 14 1 0 14 13 728 194 0 0 0 0 .23333333 50062 22.98008 3.538039 0 3.500000014901161 750930 344.7011947631836 53.07058811187744 0 0 14 1 . 0 0 0 20 15 1 0 15 14 729 194 0 0 0 0 .23333333 49772 35.929993 12.94991 0 3.7333333492279053 796352 574.8798828125 207.1985626220703 0 0 15 1 . 0 0 0 20 16 1 0 16 15 730 194 0 0 0 0 .23333333 44555 60.18102 24.251026 0 3.9666666835546494 757435 1023.077320098877 412.2674446105957 0 0 16 1 . 0 0 0 20 17 1 0 17 16 731 194 0 0 0 0 .23333333 52907 90.0826 29.901585 .9521963 4.200000017881393 952326 1621.4868621826172 538.2285232543945 17.139533400535584 0 17 1 . 0 0 0 20 18 1 0 18 17 732 194 0 0 0 0 .23333333 43340 110.55514 20.47254 9.347191 4.4333333522081375 823460 2100.5476150512695 388.97822189331055 177.59662628173828 0 18 1 . 0 0 0 20 19 1 0 19 18 733 194 0 0 0 0 .23333333 41700 120.55096 9.99582 25.256964 4.666666686534882 834000 2411.0191345214844 199.91640090942383 505.13927459716797 0 19 1 0 0 1 0 20 20 1 1 20 19 714 379 0 0 0 0 0 66339 0 0 0 0 66339 0 0 0 0 0 0 . 0 0 0 31 1 1 0 1 0 715 379 0 0 0 0 0 66523 0 0 0 0 133046 0 0 0 0 1 0 . 0 0 0 31 2 1 0 2 1 716 379 0 0 0 0 0 66176 0 0 0 0 198528 0 0 0 0 2 0 . 0 0 0 31 3 1 0 3 2 717 379 0 0 0 0 0 63046 0 0 0 0 252184 0 0 0 0 3 0 . 0 0 0 31 4 1 0 4 3 718 379 0 0 0 0 0 62767 0 0 0 0 313835 0 0 0 0 4 0 . 0 0 0 31 5 1 0 5 4 719 379 0 0 0 0 0 71338 0 0 0 0 428028 0 0 0 0 5 0 . 0 0 0 31 6 1 0 6 5 720 379 0 0 0 0 0 83189 0 0 0 0 582323 0 0 0 0 6 0 . 0 0 0 31 7 1 0 7 6 721 379 0 0 0 0 0 70688 0 0 0 0 565504 0 0 0 0 7 0 . 0 0 0 31 8 1 0 8 7 722 379 0 0 0 0 0 54859 .4293737 .4293737 0 0 493731 3.864363133907318 3.864363133907318 0 0 8 0 . 0 0 0 31 9 1 0 9 8 723 379 0 0 0 0 .23333333 42059 5.427283 4.99791 0 2.333333343267441 420590 54.2728328704834 49.97910022735596 0 0 9 0 . 0 0 0 31 10 1 0 10 9 724 379 0 0 0 0 .23333333 45153 10.20192 4.774635 0 2.566666677594185 496683 112.2211046218872 52.52098846435547 0 0 10 0 . 0 0 0 31 11 1 0 11 10 725 379 0 0 0 0 .23333333 49831 13.619734 3.4178145 0 2.800000011920929 597972 163.43680572509766 41.013773918151855 0 0 11 0 . 0 0 0 31 12 1 0 12 11 726 379 0 0 0 0 .23333333 50417 16.195976 2.576242 0 3.033333346247673 655421 210.54769134521484 33.491148710250854 0 0 12 0 . 0 0 0 31 13 1 0 13 12 727 379 0 0 0 0 .23333333 51892 19.44204 3.246065 0 3.266666680574417 726488 272.1885795593262 45.44491195678711 0 0 13 0 . 0 0 0 31 14 1 0 14 13 728 379 0 0 0 0 .23333333 50062 22.98008 3.538039 0 3.500000014901161 750930 344.7011947631836 53.07058811187744 0 0 14 0 . 0 0 0 31 15 1 0 15 14 729 379 0 0 0 0 .23333333 49772 35.929993 12.94991 0 3.7333333492279053 796352 574.8798828125 207.1985626220703 0 0 15 0 . 0 0 0 31 16 1 0 16 15 730 379 0 0 0 0 .23333333 44555 60.18102 24.251026 0 3.9666666835546494 757435 1023.077320098877 412.2674446105957 0 0 16 0 . 0 0 0 31 17 1 0 17 16 731 379 0 0 0 0 .23333333 52907 90.0826 29.901585 .9521963 4.200000017881393 952326 1621.4868621826172 538.2285232543945 17.139533400535584 0 17 0 . 0 0 0 31 18 1 0 18 17 732 379 0 0 0 0 .23333333 43340 110.55514 20.47254 9.347191 4.4333333522081375 823460 2100.5476150512695 388.97822189331055 177.59662628173828 0 18 0 . 0 0 0 31 19 1 0 19 18 733 379 0 0 0 0 .23333333 41700 120.55096 9.99582 25.256964 4.666666686534882 834000 2411.0191345214844 199.91640090942383 505.13927459716797 0 19 0 . 0 0 0 31 20 1 0 20 19 734 379 0 0 0 0 .23333333 41218 125.65192 5.100959 49.90026 4.900000020861626 865578 2638.6902465820313 107.12014532089233 1047.905559539795 0 20 0 . 0 0 0 31 21 1 0 21 20 735 379 0 0 0 0 .23333333 40713 129.67085 4.0189376 79.76623 5.13333335518837 895686 2852.758758544922 88.41662693023682 1754.8570098876953 0 21 0 . 0 0 0 31 22 1 0 22 21 736 379 0 0 0 0 .23333333 54541 134.92639 5.255534 94.14267 5.366666689515114 1254443 3103.3070068359375 120.87728595733643 2165.2814025878906 0 22 0 . 0 0 0 31 23 1 0 23 22 737 379 0 0 0 0 .23333333 56247 139.59798 4.671586 101.44357 5.600000023841858 1349928 3350.3514404296875 112.1180648803711 2434.645751953125 0 23 0 . 0 0 0 31 24 1 0 24 23 738 379 0 0 0 0 .23333333 56890 142.38031 2.7823415 105.8589 5.833333358168602 1422250 3559.5077514648438 69.55853700637817 2646.47274017334 0 24 0 . 0 0 0 31 25 1 0 25 24 739 379 0 0 0 0 .23333333 55396 145.33441 2.954091 111.10951 6.066666692495346 1440296 3778.6947021484375 76.80636787414551 2888.8473205566406 0 25 0 . 0 0 0 31 26 1 0 26 25 740 379 0 0 0 0 .23333333 52076 152.65094 7.316528 116.606 6.30000002682209 1406052 4121.575378417969 197.54625177383423 3148.3618698120117 0 26 0 . 0 0 0 31 27 1 0 27 26 741 379 0 0 0 0 .23333333 52119 161.7193 9.068373 126.66508 6.533333361148834 1459332 4528.140808105469 253.91443634033203 3546.6223754882813 0 27 0 . 0 0 0 31 28 1 0 28 27 742 379 0 0 0 0 .23333333 50841 171.85252 10.13322 140.74542 6.766666695475578 1474389 4983.723190307617 293.8633441925049 4081.6172485351563 0 28 0 . 0 0 0 31 29 1 0 29 28 743 379 0 0 0 0 .23333333 53588 191.8957 20.043163 156.5418 7.000000029802322 1607640 5756.8707275390625 601.2948989868164 4696.253814697266 0 29 0 . 0 0 0 31 30 1 0 30 29 744 379 0 0 0 0 .23333333 0 212.5228 20.62711 165.9663 7.2333333641290665 0 6588.206695556641 639.4404544830322 5144.95556640625 0 30 0 0 0 0 0 31 31 1 0 31 30 714 598 1 1 0 0 0 40457 0 0 0 0 40457 0 0 0 0 0 1 . 0 0 0 16 1 1 0 1 0 715 598 1 1 0 0 0 42105 0 0 0 0 84210 0 0 0 0 1 1 . 0 0 0 16 2 1 0 2 1 716 598 1 1 0 0 0 41772 0 0 0 0 125316 0 0 0 0 2 1 . 0 0 0 16 3 1 0 3 2 717 598 1 1 0 0 0 40189 0 0 0 0 160756 0 0 0 0 3 1 . 0 0 0 16 4 1 0 4 3 718 598 1 1 0 0 0 39026 0 0 0 0 195130 0 0 0 0 4 1 . 0 0 0 16 5 1 0 5 4 719 598 1 1 0 0 0 43281 0 0 0 0 259686 0 0 0 0 5 1 . 0 0 0 16 6 1 0 6 5 720 598 1 1 0 0 0 49240 0 0 0 0 344680 0 0 0 0 6 1 . 0 0 0 16 7 1 0 7 6 721 598 1 1 0 0 0 44938 0 0 0 0 359504 0 0 0 0 7 1 . 0 0 0 16 8 1 0 8 7 722 598 1 1 0 0 0 36474 .2067816 .2067816 0 0 328266 1.8610344976186752 1.8610344976186752 0 0 8 1 . 0 0 0 16 9 1 0 9 8 723 598 1 1 0 0 0 28519 3.618678 3.4118965 0 0 285190 36.18678092956543 34.11896467208862 0 0 9 1 . 0 0 0 16 10 1 0 10 9 724 598 1 1 0 0 0 29943 9.201781 5.583104 0 0 329373 101.21959400177002 61.41414022445679 0 0 10 1 . 0 0 0 16 11 1 0 11 10 725 598 1 1 0 0 0 31926 14.423018 5.221236 0 0 383112 173.07621002197266 62.654829025268555 0 0 11 1 . 0 0 0 16 12 1 0 12 11 726 598 1 1 0 0 0 33072 17.473045 3.050029 0 0 429936 227.14958953857422 39.65037441253662 0 0 12 1 . 0 0 0 16 13 1 0 13 12 727 598 1 1 0 0 0 32940 20.78155 3.308506 0 0 461160 290.9417190551758 46.31908082962036 0 0 13 1 . 0 0 0 16 14 1 0 14 13 728 598 1 1 0 0 0 33226 25.485834 4.704282 0 0 498390 382.2875118255615 70.56422710418701 0 0 14 1 . 0 0 0 16 15 1 0 15 14 729 598 1 1 0 0 0 34559 33.808792 8.32296 0 0 552944 540.940673828125 133.1673583984375 0 0 15 1 0 0 1 0 16 16 1 1 16 15 714 633 1 1 0 0 0 23152 0 0 0 0 23152 0 0 0 0 0 0 . 0 0 0 31 1 1 0 1 0 715 633 1 1 0 0 0 23589 0 0 0 0 47178 0 0 0 0 1 0 . 0 0 0 31 2 1 0 2 1 end format %tm date label values COVID COVID label def COVID 0 "No confirmed COVID-19", modify
Listed 100 out of 6956 observations
Use the count() option to list more
.
. stcrreg Female age80plus c.z1 c.z2 c.z3 c.z4 c.z5 c.COVID c.z1tvc c.z2tvc c.z3tvc c.z4tvc c.z5tvc c.COVIDtvc, compete(d2=2) vce(cluster ID)
Failure _d: d2==1
Analysis time _t: stop
Enter on or after: time start
ID variable: ID
Iteration 0: Log pseudolikelihood = -239.52031
Iteration 1: Log pseudolikelihood = -239.12838
Iteration 2: Log pseudolikelihood = -239.12643
Iteration 3: Log pseudolikelihood = -239.12643
Competing-risks regression No. of obs = 6,956
No. of subjects = 264
Failure event: d2 == 1 No. failed = 45
Competing event: d2 == 2 No. competing = 30
No. censored = 189
Wald chi2(14) = 34.12
Log pseudolikelihood = -239.12643 Prob > chi2 = 0.0020
(Std. err. adjusted for 264 clusters in ID)
------------------------------------------------------------------------------
| Robust
_t | SHR std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
Female | 1.085202 .3453661 0.26 0.797 .5815878 2.024911
age80plus | 1.692023 .5487433 1.62 0.105 .8960896 3.194928
z1 | .3194986 .5694249 -0.64 0.522 .0097145 10.50798
z2 | .9999984 2.06e-06 -0.76 0.449 .9999944 1.000002
z3 | 1.004033 .0166543 0.24 0.808 .9719164 1.037212
z4 | .8690125 .0892814 -1.37 0.172 .710517 1.062864
z5 | 1.011105 .0622987 0.18 0.858 .8960861 1.140887
COVID | 7.85115 27.61417 0.59 0.558 .007963 7740.894
z1tvc | 1.037434 .1078434 0.35 0.724 .8462067 1.271876
z2tvc | .9999998 1.87e-07 -0.89 0.373 .9999995 1
z3tvc | .9998533 .0008061 -0.18 0.856 .9982748 1.001434
z4tvc | 1.006519 .005446 1.20 0.230 .9959014 1.01725
z5tvc | .9999654 .0019668 -0.02 0.986 .9961179 1.003828
COVIDtvc | .9690446 .1599352 -0.19 0.849 .7012258 1.339151
------------------------------------------------------------------------------
. stcurve, cif at(COVID=(0 1)) legend(label(1 "W/o COVID-19 infection") label(2 "With COVID-19 infection") pos(6) cols(2)) lcolor(navy khaki)
note: function evaluated at specified values of selected covariates and overall means of other covariates (if any).
.
. stcompet cif=ci hi=hi low=lo, compet1(2) by(COVID)
. gen ci_case=cif if d2==1 & COVID==1
(6,953 missing values generated)
. gen lo_case=low if d2==1 & COVID==1
(6,953 missing values generated)
. gen hi_case=hi if d2==1 & COVID==1
(6,953 missing values generated)
. sort _t
.
. gen ci_case0=cif if d2==1 & COVID==0
(6,914 missing values generated)
. gen lo_case0=low if d2==1 & COVID==0
(6,914 missing values generated)
. gen hi_case0=hi if d2==1 & COVID==0
(6,914 missing values generated)
. sort _t
.
. gen ci_casedead=cif if d2==2 & COVID==1
(6,955 missing values generated)
. gen lo_casedead=low if d2==2 & COVID==1
(6,955 missing values generated)
. gen hi_casedead=hi if d2==2 & COVID==1
(6,955 missing values generated)
.
. gen ci_casedead0=cif if d2==2 & COVID==0
(6,927 missing values generated)
. gen lo_casedead0=low if d2==2 & COVID==0
(6,927 missing values generated)
. gen hi_casedead0=hi if d2==2 & COVID==0
(6,927 missing values generated)
.
.
. # delimit ;
delimiter now ;
. twoway
> (rarea hi_case lo_case _t if inrange(_t, 9,31), color(gs12%35))
> (line ci_case _t if inrange(_t, 9,31), mcolor(black) lwidth(medsmall))
> (rarea hi_case0 lo_case0 _t if inrange(_t, 8,31), color(ebblue%35))
> (line ci_case0 _t if inrange(_t, 9,31), mcolor(navy) lwidth(medsmall))
> (rarea hi_casedead lo_casedead _t if inrange(_t, 8,31), color(midgreen%35))
> (line ci_casedead _t if inrange(_t, 8,31), mcolor(green) lwidth(medsmall))
> (rarea hi_casedead0 lo_casedead0 _t if inrange(_t, 8,31), color(gs12%35))
> (line ci_casedead0 _t if inrange(_t, 8,31), mcolor(black) lwidth(medsmall)),
> name(`Y'_`g', replace)
> ;
[CODE]
I would prefer to just put 95% Confidence interval bands on the stcurve generated graph. But, the only way I could put CI bands on the cumulative incidence function graph was using the user written stcompet function, the output of which (also attached) is strange, or perhaps I am doing something wrong? I would be grateful for any guidance on how to put CI on the stcurve plots.
Many thanks in advance.
Sincerely,
Sumedha