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