help stpm2illdalso see:illdprep stpm2 stpm2_postestimation-------------------------------------------------------------------------------

Title

stpm2illd-- Illness death model post-estimation tool to estimate transition hazards and probabilities after stpm2

Syntax

stpm2illdnewvarlist[,options]

optionsDescription -------------------------------------------------------------------------trans1...trans3covariates specified by listed varname(s) be set to # when predicting hazards for each transition.obsspecifies the number of observations (of time) to predict for.cicalculates confidence intervals for probabilities.mintthe minimum value of follow up time.maxtthe maximum value of follow up time.timenamename of new time variable generated in command.hazardpredicts hazard function for each transition.haznamename given for transition hazards ifhazardspecified.combinecombines the probabilities of being in states 3 and 4 to give overall probability of death. -------------------------------------------------------------------------

Description

stpm2illdcan be used afterstpm2to 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 asprob_alive,prob_ill,prob_deadandprob_illdead.------------- > ------------- | | > | | | Alive | Transition 2 > | Ill | | |-------------->------------- > | | | State 1 | > | State 2 | | | > | | ------------- > ------------- | > | | > | | > | Transition 1 | > | Transition 3 | > | | > | | > | | > | ------------- > ------------- | | > | | | Dead | > | Dead | | | > | | | State 3 | > | State 4 | | | > | | ------------- > -------------

OptionsNote: in the table below,

vnis an abbreviation forvarname.+------+ ----+ Main +-------------------------------------------------------------

trans1(vn #[vn #..])..trans3(vn #[vn #..])requests that the covariates specified by the listedvarname(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,trans1relates to the transition from alive to dead,trans2relates to the transition from alive to ill, andtrans3relates 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.

cicalculates a 95% confidence interval for the probabilities and stores the confidence limits inprob_newvar_lciandprob_newvar_uci.

mint(#)the minimum value of follow up time. The default is set as the minimum event time fromstset.

maxt(#)the maximum value of follow up time. The default is set as the maximum event time fromstset.

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.

hazardpredicts the hazard function for each transition.

hazname(varlist)if thehazardis specified then this allows the user to specify the names for the transition hazards. These will then be stored in variables calledh_var. If nothing is specified then the default names areh_trans1,h_trans2andh_trans3.

combineallows 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 innewvarlist. 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 asprob_alive,prob_illandprob_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

illdprepcommand to set the data up in the format req > uired for illness death models usingstpm2andstpm2illd. The ID variable in the data set is calledpid. There are two event indicators;> rfiindicates whether a patient has suffered a relapse, andosiindicates whether a patient has died or not. There are also two event time vari > ables that correspond with these;rfandos.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> setthe data using the newly generatedstatusvariable as the failure indicator. Th > e newly generatedstartandstoptimes need to be included in thestsetcommand 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

stpm2including 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,trans2andtrans3> ) as both main effects and time-dependent effects (usingtvcoption) we have fitted a stratified model wit > h three separate baselines, one for each transition. For this reason we have used thercsbaseoffoption together with thenoconsopt > ion which excludes the baseline hazard from the model.

The

stpm2illdpostestimation 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> hazardoption 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_deathandprob_illdeathhave been gene > rated for the probabilities of being in each of the four states. As we have specified thehazardoption the > variablesh_trans1,h_trans2andh_trans3have also been generated.

Also seeOnline:

[ST] stpm2[ST] stpm2_postestimation;