I am trying to generate both left-censored and interval-censored datasets which both have the same features. I wish to fit and compare a cox model, Aalen's additive model and an Accelerated failure time model to these 3 datasets. I have initially generated a right-censored dataset using the below code (survsim package).

sim.data <- simple.surv.sim(n=10000, foltime=5000, dist.ev=c('llogistic'),
                            beta0.cens=7.39773677281100,z=list(c("unif", 0.8, 1.2)), beta=list(c(-0.4),
                                                                                               c(0)), x=list(c("bern", 0.5), c("unif", 0.7, 1.3)))

This represents a cohort with 10000 subjects, with a maximum follow-up time of 5000 days and two covariates, following a Bernoulli and uniform distribution respectively, and corresponding beta of -0.4 for the first covariate and a corresponding beta of 0 for the second covariate. Notice that the time to censorship is assumed to follow a Weibull distribution, as no other distribution is stated.

Any help would be greatly appreciated and any tips on changing the parameter values for better fitting in my situation.

  • 2
    $\begingroup$ Simulating censoring is a matter of creating another time to event variable. For interval censoring, you simulate on and off times. Most interval censored data are just discrete time processes, like the periodic monitoring of cancer in a cancer clinical trial. In that case, you can just use a Markov model to simulate the timepoint outcomes. $\endgroup$
    – AdamO
    Aug 1, 2023 at 19:43

1 Answer 1


The easiest thing to do would be to simulate a dataset without censoring first. You can then draw some censoring times afterwards and augment your dataset accordingly. For example for right-censoring you draw a censoring-time for each person and check whether it is smaller than the simulated event time. If it is, you set the event time to the censoring time and the event status to 0. You can do this in a similar fashion for left- and interval-censored data.

If you need to create more complex data, that may also include time-varying covariates, a discrete-time simulation may be useful. A framework for conducting those is implemented in the simDAG R-package.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.