fastcmprsk (version 1.1.1)

simulateTwoCauseFineGrayModel: Simulate data from the Fine-Gray Model

Description

Simulate data from the model proposed in Fine and Gray (1999) for two causes. Cause 1 is assumed to be of primary importance.

Usage

simulateTwoCauseFineGrayModel(nobs, beta1, beta2, X = NULL, u.min = 0,
  u.max, p = 0.5, returnX = FALSE)

Arguments

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 X is NULL (default) then X will be simulated from MVN(O, I) with n = nobs and p = length(beta1).

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 X or not. Default is TRUE. Recommended if X is NULL.

Value

Returns a list with the following:

ftime

vector of nobs simulated event times

ftime

vector of nobs simulated event indicators (0/1/2)

X

design matrix if returnX = TRUE. (simulated design matrix if X = NULL.)

Details

The function simulates data according to the setup by Fine and Gray (1999). See their paper for more information.

References

Fine J. and Gray R. (1999) A proportional hazards model for the subdistribution of a competing risk. JASA 94:496-509.

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab