simulateTwoCauseFineGrayModel {fastcmprsk} | R Documentation |
Simulate data from the model proposed in Fine and Gray (1999) for two causes. Cause 1 is assumed to be of primary importance.
simulateTwoCauseFineGrayModel(nobs, beta1, beta2, X = NULL, u.min = 0, u.max, p = 0.5, returnX = FALSE)
nobs |
Integer: Number of observations in simulated dataset. |
beta1 |
A vector of effect sizes for cause 1 of length ncovs |
beta2 |
A vector of effect sizes for cause 2 of length ncovs |
X |
A matrix of fixed covariates (nobs x ncovs). If |
u.min |
Numeric: controls lower bound of censoring distribution where C ~ U(u.min, u.max) |
u.max |
Numeric: controls upper bound of censoring distribution where C ~ U(u.min, u.max) |
p |
Numeric: value between 0 and 1 which controls the mixture probability. |
returnX |
Logical: Whether to return |
The function simulates data according to the setup by Fine and Gray (1999). See their paper for more information.
Returns a list with the following:
ftime |
vector of |
ftime |
vector of |
X |
design matrix if |
Fine J. and Gray R. (1999) A proportional hazards model for the subdistribution of a competing risk. JASA 94:496-509.
set.seed(2019) nobs <- 500 beta1 <- c(0.40, -0.40, 0, -0.50, 0, 0.60, 0.75, 0, 0, -0.80) beta2 <- -beta1 Z <- matrix(rnorm(nobs * length(beta1)), nrow = nobs) dat <- simulateTwoCauseFineGrayModel(nobs, beta1, beta2, Z, u.min = 0, u.max = 1, p = 0.5)