Monte Carlo Simulation of Survival Data
Message/Author
 Christian M. Connell posted on Monday, May 03, 2010 - 9:31 am
I am trying to create data for survival modeling that includes two categorical vars (Tx: 50/50 split; gender: 25/75 split), and a continuous covariate (ala mcex6.22).

1) How do you set-up so that all subjects have a set period of follow-up (e.g., 180 days) rather than some censoring prior to 180 days? Is it ok to re-code censoring prior to 180 as censoring @ 180? I am trying to simulate a study in which all individuals are followed for 180 days from Tx entry.

2) Is it necessary to set-up the mc model with categorical covariates , or is it ok to re-code the generated data into groups consistent with the sizes I would want in the final model?

My code is as follows:

montecarlo:
names = time Tx gender risk;
generate = time(s 180*1); hazardc = time (.02); survival = time(180*1);
nobs = 200; nreps = 1; save = data.dat;

model population:
Tx@0; Tx@1;
gender@0; gender@1;
risk@0; risk@1;

[time#1-time#181*.02];

time on Tx*-.5 gender*1 risk*.75;

analysis: basehazard = on;

model:
[time#1-time#181*.02];
time on Tx*-.5 gender*1 risk*1.75;
 Tihomir Asparouhov posted on Tuesday, May 04, 2010 - 11:44 am
1) You can not do this with "Internal Montecarlo" where censoring will always be exponential. You have to use "External Montecarlo". Read example 12.6 in the Mplus User's Guide to see what that means. Mplus will generate data in Step 1 and in Step 2 you will analyze the data. In Step 2 include the censoring definition - it should look like that

DEFINE:
if (time>180) then c=1 else c=0;
if (time>180) then time=180;

VARIABLE:
survival=time;
timecensored=c(0=not 1=right);

You should also have in Step 1

generate = time(s); hazardc = time (0); survival = time;

and remove
analysis: basehazard = on;

2)
Use

categorical=tx gender;

model population:
[Tx\$1@0]; [gender\$1@1.1];

you enter the log-odds values.