*! version 1.2 17mar2009
help stpm2 postestimation (SJ9-2: st0165)

Title

stpm2 postestimation -- Postestimation tools for stpm2

Description

The following standard postestimation commands are available after
stpm2:

command description

predict predictions, residuals, influence statistics, and other diagnostic measures

Syntax for predict

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

statistic

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

centile(#|varname) request #th centile of survival distribution

ci calculate confidence interval

cumhazard predict cumulative hazard

cumodds predict cumulative odds

density predict density function

hazard predict hazard function

hdiff1(varname # [varname # ...]) predict first hazard function for
difference in hazard functions

hdiff2(varname # [varname # ...]) predict second hazard function for
difference in hazard functions

hrdenominator(varname # [varname # ...]) specify denominator for
(time-dependent) hazard ratio

hrnumerator(varname # [varname # ...]) specify numerator for (time-dependent) hazard ratio

martingale calculate martingale residuals

meansurv calculate population-averaged survival function

normal predict standard normal deviate of survival function

sdiff1(varname # [varname # ...]) predict first survival curve for difference in survival functions

sdiff2(varname # [varname # ...]) predict second survival curve for difference in survival functions

stdp calculate standard error of predicted function

survival predict survival function

timevar(varname) define time variable used for predictions (default is timevar(_t))

xb predict the linear predictor

xbnobaseline predict the linear predictor, excluding the spline function

zeros set all covariates to zero (baseline prediction)

Subsidiary
centol(#) define tolerance level when estimating centile

deviance calculate deviance residuals

dxb calculate derivative of linear predictor

level(#) set confidence level

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

Options for predict

If a relative survival model has been fit by use of the
bhazard() option, then survival refers to relative
survival and hazard refers to excess hazard.

Main

at(varname # [varname # ...]) requests that the covariates
specified by varname be set to #. This is a useful way to
obtain out-of-sample predictions. If at() is used together with
zeros, then 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. Also see zeros.

centile(#|varname) requests the #th centile of the survival-time
distribution, calculated using the Newton-Raphson algorithm (or requests the
centiles stored in varname).

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

cumhazard predicts the cumulative hazard function.

cumodds predicts the cumulative odds-of-failure function.

density predicts the density function.

hazard predicts the hazard rate (or excess hazard rate if stpm2's bhazard() option was used).

hdiff1(varname # [varname # ...]) and hdiff2(varname # [varname # ...]) predict
the difference in hazard functions, with the first hazard function defined
by the covariate values listed for hdiff1() and the second, by
those listed for hdiff2(). By default, covariates not specified
using either option are set to zero. Setting the remaining values
of the covariates to zero may not always be sensible. If # is set to
missing (.), then varname has the values defined in the dataset.

Example: hdiff1(hormon 1) (without specifying hdiff2())
computes the difference in predicted hazard functions at hormon
= 1 compared with hormon = 0.

Example: hdiff1(hormon 2) hdiff2(hormon 1) computes the difference in
predicted hazard functions at hormon = 2 compared with hormon = 1.

Example: hdiff1(hormon 2 age 50) hdiff2(hormon 1 age 30)
computes the difference in predicted hazard functions at
hormon = 2 and age = 50 compared with hormon = 1
and age = 30.

hrdenominator(varname # [varname # ...]) specifies the denominator of the hazard
ratio. By default, all covariates not specified using this option are set to zero. See the cautionary note in hrnumerator() below.
If # is set to missing (.), then varname has the values
defined
in the dataset.

hrnumerator(varname # [varname # ...]) specifies the
numerator of the (time-dependent) hazard ratio. By default, all covariates
not specified using this option are set to zero. Setting the
remaining values of the covariates to zero may not always be sensible,
particularly with models other than those on the cumulative hazard scale, or when
more than one variable has a time-dependent effect. If # is set to missing
(.), then varname has the values defined in the dataset.

martingale calculates martingale residuals.

meansurv calculates the population-averaged survival curve. This
differs from the predicted survival curve at the mean of all the covariates
in the model. A predicted survival curve is obtained for each subject, and all
the survival curves in a population are averaged. The process can be computationally intensive.
It is recommended that the timevar() option be used to reduce the number
of survival times at which the survival curves are averaged. Combining
meansurv with the at() option enables adjusted survival curves to be
estimated.

normal predicts the standard normal deviate of the survival function.

sdiff1(varname # [varname # ...]) and sdiff2(varname # [varname # ...]) predict
the difference in survival curves, with the first survival curve defined
by the covariate values listed for sdiff1() and the second, by
those listed for sdiff2(). By default, covariates not specified
using either option are set to zero. Setting the remaining values
of the covariates to zero may not always be sensible. If # is set to
missing (.), then varname has the values defined in the dataset.

Example: sdiff1(hormon 1) (without specifying sdiff2())
computes the difference in predicted survival curves at hormon
= 1 compared with hormon = 0.

Example: sdiff1(hormon 2) sdiff2(hormon 1) computes the difference in
predicted survival curves at hormon = 2 compared with hormon = 1.

Example: sdiff1(hormon 2 age 50) sdiff2(hormon 1 age 30)
computes the difference in predicted survival curves at
hormon = 2 and age = 50 compared with hormon = 1
and age = 30.

stdp calculates the standard error of prediction and stores it in
newvar_se. stdp is available only with the xb and dxb options.

survival predicts survival time (or relative survival if
the bhazard() option was used).

timevar(varname) defines the variable used as time in the predictions.
The default is timevar(_t). This is useful for large datasets where,
for plotting purposes, predictions are needed for only 200 observations, for example.
Some caution should be taken when using this option because 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 or the zeros option to define the covariate patterns for which you require
the predictions.

xb predicts the linear predictor, including the spline function.

xbnobaseline predicts the linear predictor, excluding the spline
function, i.e., only the time-fixed part of the model.

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

Subsidiary

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

deviance calculates deviance residuals.

dxb calculates the derivative of the linear predictor.

level(#) specifies the confidence level, as a percentage, for confidence
intervals. The default is level(95)
or as set by set level.

Examples

Setup

webuse brcancer

stset rectime, failure(censrec = 1)

Proportional hazards model

stpm2 hormon, scale(hazard) df(4) eform

predict h, hazard ci

predict s, survival ci

Time-dependent effects on cumulative hazard scale

stpm2 hormon, scale(hazard) df(4) tvc(hormon) dftvc(3)

predict hr, hrnumerator(hormon 1) ci

predict survdiff, sdiff1(hormon 1) ci

predict hazarddiff, hdiff1(hormon 1) ci

Use of the at() option

stpm2 hormon x1, scale(hazard) df(4) tvc(hormon) dftvc(3)

predict s60h1, survival at(hormon 1 x1 60) ci

Also see

Article: Stata Journal, volume 9, number 2: st0165

Online: stpm2 (if installed)