*! version 1.0.0 ?????2018

Syntax for predict

Syntax for predictions following a stmerlin model

predict
newvarname
[if] [in] [,
statistic
options]

statistic

eta expected value of the linear predictor

survival survivor function

cif cumulative incidence function

hazard hazard function

chazard cumulative hazard function

logchazard log cumulative hazard function

rmst restricted mean survival time, within (0,t]

timelost time lost due to an event, within (0,t]

etadifference difference in expected value of complex predictor

hdifference difference in hazard functions

sdifference difference in survival functions

cifdifference difference in cumulative incidence functions

rmstdifference difference in restricted mean survival functions

etaratio ratio of expected value of complex predictor

hratio ratio of hazard functions

sratio ratio of survival functions

cifratio ratio of cumulative incidence functions

rmstratio ratio of restricted mean survival functions

options

Main
at(at_spec) specify covariate values for prediction

zeros set all covariates to zero

at1(at_spec) specify covariate values for prediction; for use with difference and ratio predictions

at2(at_spec) specify covariate values for prediction; for use with difference and ratio predictions

ci calculate confidence intervals

reps(#) number of bootstrap samples for cis; see details

timevar(varname) calculate predictions at specified time-points

Description

predict is a standard postestimation command of Stata.
This entry concerns use of predict after stmerlin.

predict after stmerlin creates new variables containing
observation-by-observation values of estimated observed response variables,
linear predictions of observed response variables, or other such functions.

Options

Main

eta calculates the fitted linear prediction.

survival calculates the survival function. If you have fitted a relative survival model, then this
represents the relative survival function.

cif calculates the cumulative incidence function at time t, where t is the time at which predictions are made.
This is 1 - survival.

hazard calculates the hazard function at time t, where t is the time at which predictions are made.

chazard calculates the cumulative hazard function at time t, where t is the time at which predictions are made.

logchazard calculates the log of the cumulative hazard function at time t, where t is the time at which predictions are made.

rmst calculates the restricted mean survival time, which is the integral of the survival function within the interval
(0,t], where t is the time at which predictions are made.

timelost calculates the time lost due to the event occuring, within the interval (0,t].
This is the integral of the cif between (0,t].

etadifference calculates the difference in the expected value of the complex predictor,
across the covariate patterns specified in at1() and at2().

hdifference calculates the difference in hazard function at time t, where t is the time at which predictions are made,
across the covariate patterns specified in at1() and at2().

sdifference calculates the difference in survival function at time t, where t is the time at which predictions are made,
across the covariate patterns specified in at1() and at2().

cifdifference calculates the difference in cumulative incidence function at time t, where t is the time at which predictions are made,
across the covariate patterns specified in at1() and at2().

rmstdifference calculates the difference in restricted mean survival time at time t, where t is the time at which predictions are made,
across the covariate patterns specified in at1() and at2().

etaratio calculates the ratio of the expected value of the complex predictor,
across the covariate patterns specified in at1() and at2().

hratio calculates the ratio of hazard functions at time t, where t is the time at which predictions are made,
across the covariate patterns specified in at1() and at2().

sratio calculates the ratio of survival functions at time t, where t is the time at which predictions are made,
across the covariate patterns specified in at1() and at2().

cifratio calculates the ratio of cumulative incidence functions at time t, where t is the time at which predictions are made,
across the covariate patterns specified in at1() and at2().

rmstratio calculates the ratio of restricted mean survival times at time t, where t is the time at which predictions are made,
across the covariate patterns specified in at1() and at2().

at(varname # [ varname # ...]) requests that the covariates specified by
the listed varname(s) be set to the listed # values. For example,
at(trt 1 age 50) would evaluate predictions at trt = 1 and
age = 50. This is a useful way to obtain out of sample predictions. Other covariates in your model, but
not included in at() will be set to their observed values, i.e. the values in your dataset. Note that if at()
is used together with zeros, all covariates not listed in at() are set to zero. See also zeros.

zeros sets all covariates to zero. See also at(). Note, any response variables will be skipped, i.e. not set
to zero, so if a response variable for one model is included as a covariate in another - it will not be set to zero. Also note
that it at1() and at2() are specified, then zeros applies to both.

at1(varname # [ varname # ...]) does the same as at() but for use in conjunction with ?difference or
?ratio predictions.

at2(varname # [ varname # ...]) does the same as at() but for use in conjunction with ?difference or
?ratio predictions.

ci specifies that confidence intervals are calculated for the predicted statistic. The multivariate delta
method (i.e. predictnl) is used for all calculations, except when a family(cox) model has been fitted,
in which case bootstrapping is used. The calculated confidence intervals are generated in newvarname_lci
and newvarname_uci.

reps(#) specifies the number of bootstrap samples to use when calculating confidence intervals for a prediction
from a family(cox) model. Default is reps(100).

timevar(varname) calculate predictions at specified time-points.
For survival models, the default is to calculate predictions at the response times.
For a merlin model where a timevar() was specified, then the default will use the original
timevar(). This option overides it.

Remarks

Out-of-sample prediction is allowed for all predict options.

Examples

Fit a Royston-Parmar flexible parametric model:

. webuse brcancer,clear
. stset rectime, failure(censrec) scale(365)
. stmerlin hormon, distribution(rp) df(3) tvc(hormon) dftvc(1)

Predict the survival function:

. predict s1, survival