stcrprep
- using stcox' rather than
stcrreg`
In the tutorial on using stcrep
fo rnon-parametric etsimation of the cause-specific incidence function (CIF), weights were calculayed separately in each risk group. Although, we could do the same when modelling, to mimic the behaviour of stcrreg
, we need the censoring distribution to not vary by covariates. I load the original data and run stcrprep
without the byg()
option.
use http://www.pclambert.net/data/ebmt1_stata.dta, clear
. by R. )
(Written
stset time, failure(status==1,2) scale(365.25) id(patid)
.
data settings
Survival-time
variable: patid
ID
Failure event: status==1 2_n-1], time]
Observed time interval: (time[on or before: failure
Exit for analysis: time/365.25
Time
--------------------------------------------------------------------------total observations
1,977
0 exclusions
--------------------------------------------------------------------------
1,977 observations remaining, representing
1,977 subjectsin single-failure-per-subject data
1,141 failures total analysis time at risk and under observation
3,796.057
At risk from t = 0
Earliest observed entry t = 0exit t = 8.454483
Last observed
keep(score) trans(1 2) . stcrprep, events(status)
We need to calculate the event indicator and using stset
on th expanded data, and then can use `stcox’ to fit a proportional subhazards model for relapse.
generate event = status == failcode
.
stset tstop [iw=weight_c], failure(event) enter(tstart) noshow
.
data settings
Survival-time
Failure event: event!=0 & event<.
Observed time interval: (0, tstop]on or after: time tstart
Enter on or before: failure
Exit iweight=weight_c]
Weight: [
--------------------------------------------------------------------------total observations
127,730
0 exclusions
--------------------------------------------------------------------------
127,730 observations remaining, representingin single-record/single-failure data
1,141 failures total analysis time at risk and under observation
14,418.735
At risk from t = 0
Earliest observed entry t = 0exit t = 8.454483
Last observed
stcox i.score if failcode == 1, nolog
.
for ties
Cox regression with Breslow method
of subjects = 72,880 Number of obs = 72,880
No. of failures = 456
No. at risk = 6,026.2743
Time chi2(2) = 9.63
LR chi2 = 0.0081
Log likelihood = -3333.3112 Prob >
------------------------------------------------------------------------------ratio Std. err. z P>|z| [95% conf. interval]
_t | Haz.
-------------+----------------------------------------------------------------score |
Medium risk | 1.271235 .1593392 1.91 0.056 .9943389 1.625238
High risk | 1.769899 .3219273 3.14 0.002 1.239148 2.52798
------------------------------------------------------------------------------
estimates store stcox .
The output gives the subhazard ratios for the medium- and high-risk groups. I have previously fitted a stcrreg model and compare the parameter estimates below.
estimates table stcrreg stcox, eq(1:1) se
.
----------------------------------------stcox
Variable | stcrreg
-------------+--------------------------score |
Medium risk | .23997769 .23998867
| .1222701 .12534204
High risk | .57089666 .57092254
| .18298324 .18189019
---------------------------------------- Legend: b/se
The parameter estimates are the same as those produced by stcrreg to four decimal places. The standard errors are slightly different because I did not use a clustered sandwich estimator: Geskus (2011) showed that the sandwich estimator was asymptotically unbiased, but less efficient than using the standard errors derived with the observed information matrix.
Below I use stset
again, but now use pweigts
rather than iweights
. To allow for cluster robust standard errors, I use vce(cluster patid)
when using stcox
.
stset tstop [pw=weight_c], failure(event) enter(tstart) noshow
.
data settings
Survival-time
Failure event: event!=0 & event<.
Observed time interval: (0, tstop]on or after: time tstart
Enter on or before: failure
Exit pweight=weight_c]
Weight: [
--------------------------------------------------------------------------total observations
127,730
0 exclusions
--------------------------------------------------------------------------
127,730 observations remaining, representingin single-record/single-failure data
1,141 failures total analysis time at risk and under observation
14,418.735
At risk from t = 0
Earliest observed entry t = 0exit t = 8.454483
Last observed
stcox i.score if failcode == 1, nolog vce(cluster patid)
. sum of wgt is 72,880.4685663047)
(
for ties
Cox regression with Breslow method
of subjects = 72,880 Number of obs = 94,284
No. of failures = 456
No. at risk = 6,026.2743
Time chi2(2) = 9.87
Wald chi2 = 0.0072
Log pseudolikelihood = -3333.3112 Prob >
for 1,977 clusters in patid)
(Std. err. adjusted
------------------------------------------------------------------------------
| Robustratio std. err. z P>|z| [95% conf. interval]
_t | Haz.
-------------+----------------------------------------------------------------score |
Medium risk | 1.271235 .1554034 1.96 0.050 1.000391 1.615406
High risk | 1.769899 .3238307 3.12 0.002 1.236539 2.533315
------------------------------------------------------------------------------
estimates store stcox_robust
.
estimates table stcrreg stcox_robust, modelwidth(13) eq(1:1) se
.
----------------------------------------------
Variable | stcrreg stcox_robust
-------------+--------------------------------score |
Medium risk | .23997769 .23998867
| .1222701 .122246
High risk | .57089666 .57092254
| .18298324 .18296561
---------------------------------------------- Legend: b/se
Using pweights
rather than iweights
, along with the vce(cluster patid)
option for the stcox
command, leads to the standard errors being the same as stcrreg
to four decimal places.
References
Geskus, R. B. Cause-specific cumulative incidence estimation and the Fine and Gray model under both left truncation and right censoring. Biometrics 2011; 67:39–49.