*! version 2.3 11Nov2018
help stpm2cr postestimation
also see: stpm2cr

Title

[ST] stpm2cr postestimation -- Post-estimation tools for stpm2cr

Description

The following standard post-estimation commands are available:

command description

estat post estimation statistics

predict predictions, residuals etc

Syntax for predict

predict newvar [if] [in] [, statistic ]

Note: in the table below, vn is an abbreviation for varname. Each cause-specific prediction is stored in newvar_c# where # is the indicator value.

statistic

Main
at(vn # [vn # ...]) predict at values of specified covariates

ci calculate confidence intervals

cumhazard cumulative subdistribution hazard

cumodds cumulative odds

cured cure proportion

subdensity subdensity function

subhazard subdistribution hazard function

csh cause-specific hazard function

shrnumerator(vn # [vn # ...]) numerator for (time-dependent) subdistribution hazard ratio

shrdenominator(vn # [vn # ...]) denominator for (time-dependent) subdistribution hazard ratio

chrnumerator(vn # [vn # ...]) numerator for (time-dependent) cause-specific hazard ratio

chrdenominator(vn # [vn # ...]) denominator for (time-dependent) cause-specific hazard ratio

cifdiff1(vn # [vn # ...]) 1st cumulative incidence function for difference in cumulative incidence functions

cifdiff2(vn # [vn # ...]) 2nd cumulative incidence function for difference in cumulative incidence functions

cifratio relative contribution to overall risk of a cause-specific cumulative incidence function

stdp standard error of predicted function

timevar(vn) time variable used for predictions (default _t)

unccured obtain cause-specific cumulative incidence and subdistribution hazard functions for the 'uncured'

xb the linear predictor

zeros sets all covariates to zero (baseline prediction)

Subsidiary
dxb derivative of linear predictor

level(#) sets confidence level (default 95)

Statistics are available both in and out of sample; type
predict ... if e(sample) ... if wanted only for the
estimation sample.

Options for predict

Main

at(varname # [ varname # ...]) requests that the covariates specified by
the listed varname(s) be set to the listed # values. For example,
at(x1 1 x3 50) would evaluate predictions at x1 = 1 and
x3 = 50. This is a useful way to obtain
out of sample predictions. Note that if at() is used together
with zeros all covariates not listed in at()
are set to zero. If at() is used without zeros then
all covariates not listed in at() are set to their sample
values. See also zeros.

cifdiff1(varname # ...), cifdiff2(varname # ...) predicts
the difference in cause-specific cumulative incidence functions with the first
cause-specific cumulative incidence function defined by the covariate values
listed for cifdiff1() and the second by
those listed for cifdiff2(). By default, covariates not specified
using either option are set to zero. Note that setting the remaining values
of the covariates to zero may not always be sensible. If # is set to
missing (.) then varname takes its observed values in the dataset.

Example: cifdiff1(stage 1) (without specifying cifdiff2())
computes the difference in predicted cause-specific cumulative incidence functions at stage
= 1 compared with stage = 0 and all other covariates are set to 0.

Example: cifdiff1(stage 2) cifdiff2(stage 1) computes the difference in
predicted cause-specific cumulative incidence functions at stage = 2 compared with stage = 1.

Example: cifdiff1(stage 2 age 50) cifdiff2(stage 1 age 30)
computes the difference in predicted cause-specific cumulative incidence functions at
stage = 2 and age = 50 compared with stage = 1
and age =30.

cifratio predicts the relative contribution of failing from an event to the overall
cumulative incidence function. For example, if the event of interest is in cancer, this is the
relative contribution of dying fromcancer to the total mortality.

csh predicts the cause-specific hazard function.

ci calculate a confidence interval for the requested statistic and
stores the confidence limits in newvar_lci and
newvar_uci.

cumsubhazard predicts the cumulative subdistribution hazard function.

cumodds predicts the cumulative odds of failure function.

cure predicts the cause-specific cure proportion after fitting a cure model.

subdensity predicts the sub-density function.

subhazard predicts the subdistribution hazard function.

shrdenominator(varname # ...) and chrdenominator(varname # ...)
specifies the denominator of the cause-specific hazard ratio or subdistribution
hazard ratio for a specific cause. By default, all covariates not specified using
this option are set to zero. See the cautionary note in {\opt chrnumerator}
and {\opt shrnumerator} below. If # is set to missing (.)
then varname takes its observed values in the dataset.

shrnumerator(varname # ...) and chrnumerator(varname # ...) predicts
the (time-dependent) cause-sepcific or subdistribution hazard ratio
with the numerator of the hazard ratio for a particular cause. By default all covariates other than
varname and any other variables mentioned are set to zero. Note that
setting the remaining values of the covariates to zero may not always be
sensible, particularly with models other than on the cumulative subdistribution hazard scale,
or when more than one variable has a time-dependet effect. If # is set
to missing (.) then varname takes its observed values in the dataset.

stdp calculates standard error of prediction and stores it in
newvar_se. Only available for the xb, dxb,
xbnobaseline and rmst options.

timevar(varname) defines the variable used as time in the predictions.
Default varname is _t. This is useful for large datasets where
for plotting purposes predictions are only needed for 200 observations for example.
Note that some caution should be taken when using this option as predictions may be
made at whatever covariate values are in the first 200 rows of data.
This can be avoided by using the at() option and/or the zeros option to
define the covariate patterns for which you require the predictions.

uncured can be used after fitting a cure model. It can be used with the
cif or the subhazard options to base predictions
for the 'uncured' group.

xb predicts the linear predictor, including the spline function.

zeros sets all covariates to zero (baseline prediction). For
example, predict s0, survival zeros calculates the baseline
survival function. See also at().

Subsidiary

centol(#) defines the tolerance when searching for predicted
suvival time at a given centile of the survival distribution. Default
# is 0.0001.

dxb calculates the derivative of the linear predictor.

level(#) sets the confidence level; default is level(95)
or as set by (help set level}.

Examples

Setup

use http://www.stata-journal.com/software/sj4-2/st0059/prostatecancer

stset time, failure(status==1, 2, 3) scale(12) id(id) noshow

tab treatment, gen(trt)

Proportional subdistribution hazards model

stpm2cr [prostate: , scale(hazard) df(4)] [CVD: , scale(hazard) df(4)] [other: , scale(hazard) df(4)], events(status) cause(1 2 3) cens(0) eform

predict cif, cif ci

gen CVD = cif_c1 + cif_c2

gen Other = CVD + cif_c3

gen Cancer = cif_c1

twoway (area Other _t, sort) (area CVD _t, sort) (area Cancer _t, sort), ylab(0(0.2)1) ytitle(Cumulative Incidence)

Time-dependent effects on cumulative hazard scale

stpm2cr [prostate: trt2, scale(hazard) df(4) tvc(trt2) dftvc(2)] [CVD: trt2, scale(hazard) df(4) tvc(trt2) dftvc(2)] [other: trt2, scale(hazard) df(4) tvc(trt2) dftvc(2)], events(status) cause(1 2 3) cens(0) eform

Use of at() option

predict cif_trt2, cif at(trt1 0 trt2 1) ci

gen CVD_trt2 = cif_c1 + cif_trt2_c2

gen Other_trt2 = CVD_trt2 + cif_trt2_c3

gen Cancer_trt2 = cif_trt2_c1

twoway (area Other_trt2 _t, sort) (area CVD_trt2 _t, sort) (area Cancer_trt2 _t, sort), ylab(0(0.2)1) ytitle(Cumulative Incidence)

Obtain relative and absolute predictions

predict shr_trt2, shrnumerator(trt2 1) shrdenominator(trt1 1) ci

line shr_trt2_c1 shr_trt2_c2 shr_trt2_c3 _t, sort yline(1, lpattern(dash)) ytitle(Rate of Failure)

predict cifdiff, cifdiff1(trt2 1) ci

line cifdiff_c1* _t, sort lpattern(solid dash dash) scheme(sj) ytitle(Cumulative Incidence) title(Prostate Cancer) name(g1) legend(off)

line cifdiff_c2* _t, sort lpattern(solid dash dash) scheme(sj) ytitle(Cumulative Incidence) title(CVD) name(g2) legend(off)

line cifdiff_c3* _t, sort lpattern(solid dash dash) scheme(sj) ytitle(Cumulative Incidence) title(Other) name(g3) legend(off)

graph combine g1 g2 g3, nocopies ycommon cols(3)

predict cifratio, cifratio at(trt2 1)

gen CVD_ratio = cifratio_c1 + cifratio_c2

gen Other_ratio = CVD_ratio + cifratio_c3

gen Cancer_ratio = cifratio_c1

twoway (area Other_ratio _t, sort) (area CVD_ratio _t, sort) (area Cancer_ratio _t, sort), ytitle(Relative Contribution to Total Mortality)

References

P. C. Lambert and P. Royston. Further development of flexible parametric
models for survival analysis. Stata Journal 2009;9:265-290

P. Royston, P.C. Lambert. Flexible parametric survival analysis in Stata:
Beyond the Cox model StataPress, 2011

Also see

Online: [ST] stpm2cr;