help illdprep 
                            also see:  stpm2  stpm2illd  stpm2_postestimation  
-------------------------------------------------------------------------------

Title

illdprep -- Sets the data up in the format required for illness death models using stpm2 and stpm2illd.

Syntax

illdprep [, options]

options Description ------------------------------------------------------------------------- id specifies the name of the ID variables in your data set. statevar specifies the names of the two event indicator variables e.g. relapse and dead. statetime specifies the names of the two event time variables e.g. relapsetime and survtime. status allows user to specify the name of the newly generated status variable. -------------------------------------------------------------------------

Description

illdprep is used to set up the data in the required format for illness death models using stpm2 and stpm2illd.

The command will expand the data so that each individual will have up to 3 rows > of data. Six new variables will be created. The variables trans1, trans2 and trans3 are variables that indicate whether an individual has passed through > that particular transition. The transition numbers correspond to those in th > e diagram below. The status variable is an additional event indicator that summar > izes the information from trans1, trans2 and trans3. Finally, the variables start and stop give the times at which each individual enters and > leaves each transition.

------------- > ------------- | | > | | | Alive | Transition 2 > | Ill | | |-------------->------------- > | | | State 1 | > | State 2 | | | > | | ------------- > ------------- | > | | > | | > | Transition 1 | > | Transition 3 | > | | > | | > | | > | ------------- > ------------- | | > | | | Dead | > | Dead | | | > | | | State 3 | > | State 4 | | | > | | ------------- > ------------- Options

id specifies the name of the id variable in the data set. Before the command is used each id number should have just 1 row of data. The command will expand the data so that each id number will have up to 3 rows of data.

statevar(varlist) specifies the names of the two event indicator variables needed to split the data. Looking at the diagram above, an indicator variable will be needed to specify whether a patient has become ill and whether a patient has died. As death is a final absorbing state this must come last in the varlist. So for example if we were interested in relapse and death and our event indicator variables were relapse and dead then we would specify statevar(relapse dead) in that order.

statetime(varlist) specifies the names of the two event time variables. The variables should be inputted in the order that corresponds to statevar(varlist). So if our event time variables were relapsetime and survtime then we would specify statetime(relapsetime survtime) in that order to correspond with the example given for statevar(varlist).

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))

Once the data is stset we can run the stpm2 and stpm2illd commands to fit an il > lness death model.

Also see

Online: [ST] stpm2 [ST] stpm2_postestimation;