**[ST] stcrreg postestimation** -- Postestimation tools for stcrreg

__Postestimation commands__

The following postestimation command is of special interest after
**stcrreg**:

Command Description
-------------------------------------------------------------------------
**stcurve** plot the cumulative subhazard and cumulative incidence
functions
-------------------------------------------------------------------------

The following standard postestimation commands are also available:

Command Description
-------------------------------------------------------------------------
**contrast** contrasts and ANOVA-style joint tests of estimates
**estat ic** Akaike's and Schwarz's Bayesian information criteria
(AIC and BIC)
**estat summarize** summary statistics for the estimation sample
**estat vce** variance-covariance matrix of the estimators (VCE)
**estimates** cataloging estimation results
**hausman** Hausman's specification test
**lincom** point estimates, standard errors, testing, and
inference for linear combinations of coefficients
**margins** marginal means, predictive margins, marginal effects,
and average marginal effects
**marginsplot** graph the results from margins (profile plots,
interaction plots, etc.)
**nlcom** point estimates, standard errors, testing, and
inference for nonlinear combinations of coefficients
**predict** predictions, residuals, influence statistics, and
other diagnostic measures
**predictnl** point estimates, standard errors, testing, and
inference for generalized predictions
**pwcompare** pairwise comparisons of estimates
**test** Wald tests of simple and composite linear hypotheses
**testnl** Wald tests of nonlinear hypotheses
-------------------------------------------------------------------------

__Syntax for predict__

**predict** [*type*] *newvar* [*if*] [*in*] [**,** *sv_statistic* __nooff__**set**]

**predict** [*type*] {*stub******|*newvarlist*} [*if*] [*in*] **,** *mv_statistic* [__part__**ial**]

*sv_statistic* Description
-------------------------------------------------------------------------
Main
**shr** predicted subhazard ratio, also known as the relative
subhazard; the default
**xb** linear prediction xb
**stdp** standard error of the linear prediction; SE(xb)
* **basecif** baseline cumulative incidence function (CIF)
* __basecsh__**azard** baseline cumulative subhazard function
* __kmc__**ensor** Kaplan-Meier survivor curve for censoring distribution
-------------------------------------------------------------------------

*mv_statistic* Description
-------------------------------------------------------------------------
Main
* __sco__**res** pseudolikelihood scores
* **esr** efficient score residuals
* __dfb__**eta** DFBETA measures of influence
* __sch__**oenfeld** Schoenfeld residuals
-------------------------------------------------------------------------
Unstarred statistics are available both in and out of sample; type
**predict** *...* **if e(sample)** *...* if wanted only for the estimation sample.
Starred statistics are calculated only for the estimation sample, even
when **if e(sample)** is not specified.
**nooffset** is allowed only with unstarred statistics.

__Menu for predict__

**Statistics > Postestimation**

__Description for predict__

**predict** creates a new variable containing predictions such as subhazard
ratios, linear predictions, standard errors, baseline cumulative
incidence and subhazard functions, Kaplan-Meier survivor curves,
pseudolikelihood scores, efficient score and Schoenfeld residuals, and
DFBETA measures of influence.

__Options for predict__

+------+
----+ Main +-------------------------------------------------------------

**shr**, the default, calculates the relative subhazard (subhazard ratio),
that is, the exponentiated linear prediction.

**xb** calculates the linear prediction from the fitted model. That is, you
fit the model by estimating a set of parameters, b1, b2, ..., bk, and
the linear prediction is xb.

The x used in the calculation is obtained from the data currently in
memory and need not correspond to the data on the independent
variables used in estimating b.

**stdp** calculates the standard error of the prediction, that is, the
standard error of xb.

**basecif** calculates the baseline CIF. This is the CIF of the
subdistribution for the cause-specific failure process.

**basecshazard** calculates the baseline cumulative subhazard function. This
is the cumulative hazard function of the subdistribution for the
cause-specific failure process.

**kmcensor** calculates the Kaplan-Meier survivor function for the censoring
distribution. These estimates are used to weight within risk pools
observations that have experienced a competing event. As such, these
values are not predictions or diagnostics in the strict sense, but
are provided for those who wish to reproduce the pseudolikelihood
calculations performed by **stcrreg**.

**nooffset** is allowed only with **shr**, **xb**, and **stdp**, and is relevant only if
you specified **offset(***varname***)** for **stcrreg**. It modifies the
calculations made by **predict** so that they ignore the offset variable;
the linear prediction is treated as xb rather than xb + offset.

**scores** calculates the pseudolikelihood scores for each regressor in the
model. These scores are components of the robust estimate of
variance. For multiple-record data, by default only one score per
subject is calculated and it is placed on the last record for the
subject.

Adding the **partial** option will produce partial scores, one for each
record within subject; see **partial** below. Partial pseudolikelihood
scores are the additive contributions to a subject's overall
pseudolikelihood score. In single-record data, the partial
pseudolikelihood scores are the pseudolikelihood scores.

One score variable is created for each regressor in the model; the
first new variable corresponds to the first regressor, the second to
the second, and so on.

**esr** calculates the efficient score residuals for each regressor in the
model. Efficient score residuals are diagnostic measures equivalent
to pseudolikelihood scores, with the exception that efficient score
residuals treat the censoring distribution (that used for weighting)
as known rather than estimated. For multiple-record data, by default
only one efficient score per subject is calculated and it is placed
on the last record for the subject.

Adding the **partial** option will produce partial efficient score
residuals, one for each record within subject; see **partial** below.
Partial efficient score residuals are the additive contributions to a
subject's overall efficient score residual. In single-record data,
the partial efficient scores are the efficient scores.

One efficient score variable is created for each regressor in the
model; the first new variable corresponds to the first regressor, the
second to the second, and so on.

**dfbeta** calculates the DFBETA measures of influence for each regressor in
the model. The DFBETA value for a subject estimates the change in
the regressor's coefficient due to deletion of that subject. For
multiple-record data, by default only one value per subject is
calculated and it is placed on the last record for the subject.

Adding the **partial** option will produce partial DFBETAs, one for each
record within subject; see **partial** below. Partial DFBETAs are
interpreted as effects due to deletion of individual records rather
than deletion of individual subjects. In single-record data, the
partial DFBETAs are the DFBETAs.

One DFBETA variable is created for each regressor in the model; the
first new variable corresponds to the first regressor, the second to
the second, and so on.

**schoenfeld** calculates the Schoenfeld-like residuals. Schoenfeld-like
residuals are diagnostic measures analogous to Schoenfeld residuals
in Cox regression. They compare a failed observation's covariate
values to the (weighted) average covariate values for all those at
risk at the time of failure. Schoenfeld-like residuals are
calculated only for those observations that end in failure; missing
values are produced otherwise.

One Schoenfeld residual variable is created for each regressor in the
model; the first new variable corresponds to the first regressor, the
second to the second, and so on.

Note: The easiest way to use the preceding four options is, for example,

**. predict double** *stub****, scores**

where *stub* is a short name of your choosing. Stata then creates
variables *stub***1**, *stub***2**, etc. You may also specify each variable name
explicitly, in which case there must be as many (and no more)
variables specified as there are regressors in the model.

**partial** is relevant only for multiple-record data and is valid with
**scores**, **esr**, and **dfbeta**. Specifying **partial** will produce "partial"
versions of these statistics, where one value is calculated for each
record instead of one for each subject. The subjects are determined
by the **id()** option to **stset**.

Specify **partial** if you wish to perform diagnostics on individual
records rather than on individual subjects. For example, a partial
DFBETA would be interpreted as the effect on a coefficient due to
deletion of one record, rather than the effect due to deletion of all
records for a given subject.

__Syntax for margins__

**margins** [*marginlist*] [**,** *options*]

**margins** [*marginlist*] **,** __pr__**edict(***statistic *...**)** [__pr__**edict(***statistic *...**)**
...] [*options*]

*statistic* Description
-------------------------------------------------------------------------
**shr** predicted subhazard ratio, also known as the relative
subhazard; the default
**xb** linear prediction xb
**stdp** not allowed with **margins**
**basecif** not allowed with **margins**
__basecsh__**azard** not allowed with **margins**
__kmc__**ensor** not allowed with **margins**
__sco__**res** not allowed with **margins**
**esr** not allowed with **margins**
__dfb__**eta** not allowed with **margins**
__sch__**oenfeld** not allowed with **margins**
-------------------------------------------------------------------------

Statistics not allowed with **margins** are functions of stochastic
quantities other than **e(b)**.

For the full syntax, see **[R] margins**.

__Menu for margins__

**Statistics > Postestimation**

__Description for margins__

**margins** estimates margins of response for subhazard ratios and linear
predictions.

__Examples of predictions after stcrreg__

Setup
**. webuse hypoxia**

Declare data to be survival-time data
**. stset dftime, failure(failtype==1)**

Fit competing-risks model
**. stcrreg ifp tumsize pelnode, compete(failtype==2)**

Obtain the relative subhazards
**. predict double shr**

Obtain the baseline cumulative subhazard function
**. predict double bcsh, basecsh**

Obtain DFBETA measures of influence
**. predict double df*, dfbeta**

Plot the first DFBETA versus analysis time
**. twoway scatter df1 _t**

__Example of using stcurve after stcrreg__

Setup
**. webuse hypoxia, clear**

Declare data to be survival-time data
**. stset dftime, failure(failtype==1)**

Fit competing-risks model
**. stcrreg ifp tumsize pelnode, compete(failtype==2)**

Use **stcurve** to compare CIFs
**. stcurve, cif at1(pelnode=0) at2(pelnode=1)**