Generates right censored time-to-event data. Latent event times are drawn from a Weibull distribution, while censoring times are generated from an exponential distribution.
simsurvdata(a, b, n, betas, censperc, tmax = NULL)An object of class `simsurvdata` which is a list with the following components:
Sample size.
Censoring scheme. Either No censoring or Exponential.
Number of events.
The effective censoring percentage.
A data frame containing the simulated data.
The true regression coefficients used to simulate the data.
The baseline survival function under the chosen Weibull parameterization.
The baseline hazard function under the chosen Weibull parameterization.
The mean of the Weibull used to generate latent event times.
The variance of the Weibull used to generate latent event times.
The `print` method summarizes the generated right censored data and the `plot` method produces a graph with time on the x axis and horizontal bars on the y axis corresponding either to an event or a right censored observation. If `n > 25`, only the 25 first observations are plotted.
The shape parameter `a>0` and scale parameter `b>0` of the Weibull.
Sample size.
A numeric vector of regression coefficients. Allowed components of `betas` are in the interval [-1 ,1] and the total number of components cannot exceed 5.
A numeric value in [0,100] corresponding to the targeted percentage of censoring.
A maximum upper bound for the generated latent event times. Especially useful for a simulation study in which the observed event times are constrained to be generated in a fixed range.
Oswaldo Gressani oswaldo_gressani@hotmail.fr.
The Weibull baseline hazard is parameterized as follows (see Hamada et al. 2008 pp. 408-409) : $$h_0(t) = (a/(b^a)) t^(a-1), t > 0.$$ The ith latent event time is denoted by T_i and is generated following Bender et al. (2005) as follows: $$T_i = b (-log(U_i) exp(-\beta^T x_i))^(1/a),$$ where U_i is a uniform random variable obtained with `runif(1)` , x_i is the ith row of a covariate matrix X of dimension `c(n, length(betas))` where each component is generated from a standard Gaussian distribution and \(\beta\) is the vector of regression coefficients given by `betas`.
Bender, R., Augustin, T. and Blettner, M. (2005). Generating survival times to simulate Cox proportional hazards models, Statistics in Medicine 24(11): 1713-1723.
Hamada, M. S., Wilson, A., Reese, C. S. and Martz, H. (2008). Bayesian Reliability. Springer Science and Business Media.
set.seed(10)
sim <- simsurvdata(a = 2, b = 1, n = 300, betas = c(0.8, -0.6), censperc = 25)
sim
plot(sim)
Run the code above in your browser using DataLab