help stpm2illd
also see: illdprep stpm2 stpm2_postestimation
-------------------------------------------------------------------------------
Title
stpm2illd -- Illness death model post-estimation tool to estimate
transition hazards and probabilities after stpm2
Syntax
stpm2illd newvarlist [, options]
options Description
-------------------------------------------------------------------------
trans1...trans3 covariates specified by listed
varname(s) be set to # when
predicting hazards for each
transition.
obs specifies the number of observations
(of time) to predict for.
ci calculates confidence intervals for
probabilities.
mint the minimum value of follow up time.
maxt the maximum value of follow up time.
timename name of new time variable generated
in command.
hazard predicts hazard function for each
transition.
hazname name given for transition hazards if
hazard specified.
combine combines the probabilities of being
in states 3 and 4 to give overall
probability of death.
-------------------------------------------------------------------------
Description
stpm2illd can be used after stpm2 to obtain transition hazards and
probabilities in an illness death model.
Four names should be specified in the newvarlist. The new variables names shoul
> d be specified in the order according to the diagram below.
So for example, if we write "alive ill dead illdead" in the newvarlist then the
> probability of being in each state as a function of time will be stored as
prob_alive, prob_ill, prob_dead and prob_illdead.
-------------
> -------------
| |
> | |
| Alive | Transition 2
> | Ill |
| |-------------->-------------
> | |
| State 1 |
> | State 2 |
| |
> | |
-------------
> -------------
|
> |
|
> |
|
> |
Transition 1 |
> | Transition 3
|
> |
|
> |
|
> |
|
> |
-------------
> -------------
| |
> | |
| Dead |
> | Dead |
| |
> | |
| State 3 |
> | State 4 |
| |
> | |
-------------
> -------------
Options
Note: in the table below, vn is an abbreviation for varname.
+------+
----+ Main +-------------------------------------------------------------
trans1(vn # [vn # ..])..trans3(vn # [vn # ..]) requests that the
covariates specified by the listed varname(s) be set to # when
predicting the hazards for each transition. It is complusory to
specify all of these. The transition numbers correspond to those in
the diagram above. Therefore, trans1 relates to the transition from
alive to dead, trans2 relates to the transition from alive to ill,
and trans3 relates to the transition from ill to dead.
obs(integer) specifies the number of observations (of time) to predict
for (default 1000). Observations are evenly spread between the
minimum and maximum value of follow-up time.
ci calculates a 95% confidence interval for the probabilities and stores
the confidence limits in prob_newvar_lci and prob_newvar_uci.
mint(#) the minimum value of follow up time. The default is set as the
minimum event time from stset.
maxt(#) the maximum value of follow up time. The default is set as the
maximum event time from stset.
timename(varname) is the name given to time variable used for predictions
(default {\it \_newt}). Note that this is the variable for time that
needs to be used when plotting curves for the transition hazards and
probabiltiies.
hazard predicts the hazard function for each transition.
hazname(varlist) if the hazard is specified then this allows the user to
specify the names for the transition hazards. These will then be
stored in variables called h_var. If nothing is specified then the
default names are h_trans1, h_trans2 and h_trans3.
combine allows the user to combine the probabilities of being in states 3
and 4 to give the overall probability of death. If this option is
specified then the user only needs to give three names in newvarlist.
The last name given in the list should correspond to the combined
probability of states 3 and 4. So for example, if we write "alive ill
dead" in the newvarlist then the probability of being in each state
as a function of time will be stored as prob_alive, prob_ill and
prob_dead.
Example
The Rotterdam breast cancer data used in this example is taken from the book "F
> lexible Parametric Survival Analysis Using Stata: Beyond the Cox Model"
by Patrick Royston and Paul C. Lambert (2011). The data can be downloaded from
> http://www.stata-press.com/data/fpsaus.html.
The data contains information on 2,982 with primary breast cancer. Both time to
> relapse and time to death are recorded.
Open the data and run the illdprep command to set the data up in the format req
> uired for illness death models using stpm2 and stpm2illd.
The ID variable in the data set is called pid. There are two event indicators;
> rfi indicates whether a patient has suffered a relapse, and osi
indicates whether a patient has died or not. There are also two event time vari
> ables that correspond with these; rf and os.
use rott2, clear
illdprep, id(pid) statevar(rfi osi) statetime(rf os)
The command has expanded the data so that each individual has up to 3 rows of d
> ata. As described above, six new variables have been generated. We can now st
> set
the data using the newly generated status variable as the failure indicator. Th
> e newly generated start and stop times need to be included in the
stset command to indicate when an individual enters and leaves a transition.
stset stop, enter(start) failure(status==1) scale(12) exit(time
start+(10*12))
We can now run stpm2 including each of the three transitions in the model.
stpm2 trans1 trans2 trans3, scale(hazard) rcsbaseoff nocons dftvc(3)
tvc(trans1 trans2 trans3) initstrata(trans)
Note that by including the three transition variables trans1, trans2 and trans3
> ) as both main effects and
time-dependent effects (using tvc option) we have fitted a stratified model wit
> h three separate baselines, one for each transition.
For this reason we have used the rcsbaseoff option together with the nocons opt
> ion which excludes the baseline hazard from the model.
The stpm2illd postestimation command can now be run to obtain the probability o
> f being in each of the four states,
as demonstrated in the above diagram, as a function of time. By specifying the
> hazard option the command will also
predict the hazard function for each of the three transitions.
stpm2illd alive ill death illdeath, trans1(trans1 1) trans2(trans2 1)
trans3(trans3 1) hazard
The variables prob_alive, prob_ill, prob_death and prob_illdeath have been gene
> rated for the probabilities
of being in each of the four states. As we have specified the hazard option the
> variables h_trans1, h_trans2 and
h_trans3 have also been generated.
Also see
Online: [ST] stpm2 [ST] stpm2_postestimation;