sim_cox_msm_semicmrsk: Simulating Semi-competing Risks with Right-censored Survival...

View source: R/sim_cox_msm_semicmprsk.R

sim_cox_msm_semicmrskR Documentation

Simulating Semi-competing Risks with Right-censored Survival Data under Marginal Structural Illness-death Cox Model

Description

The function to simulate semi-competing risk with right-censored survival data under marginal structural illness-death Cox model.

Usage

sim_cox_msm_semicmrsk(beta1,beta2,beta3,sigma_2,
        alpha0,alpha1,alpha2,alpha3,
        n,Cens)

Arguments

beta1

True value of β_1 in the illness-death model.

beta2

True value of β_2 in the illness-death model.

beta3

True value of β_3 in the illness-death model.

sigma_2

True value of variance of normal frailty σ^2 in the illness-death model, if σ^2 = 0, then there is no frailty term.

alpha0

True value of α_0 in the propensity score model.

alpha1

True value of α_1 in the propensity score model.

alpha2

True value of α_2 in the propensity score model.

alpha3

True value of α_3 in the propensity score model.

n

Sample size.

Cens

Censoring distribution.

Details

We simulate data followed by Xu(2010) to generate semi-competing risk data under illness-death model, where we have baseline hazard λ_{01}(t) = λ_{02}(t) = 2exp(-t)I(0 ≤ t ≤ 3) + 2exp(-3)I(t ≥ 3), and λ_{03}(t) = 2λ_{01}(t).

We also have the propensity score model to generate treatment assignment P_A = logit^{-1}(α_0 + α_1 Z_1 + α_2 Z_2 + α_3 Z3).

Value

Returns a data frame that contains time to non-terminal event, T1, terminal event, T2 and censoring time C with their event indicator, delta1 and delta2. Three covariates Z1, Z2, Z3, and treatment assignment A are also included.

Examples

n <- 500
set.seed(1234)
Cens = runif(n,0.7,0.9)
set.seed(1234)
OUT1 <- sim_cox_msm_semicmrsk(beta1 = 1,beta2 = 1,beta3 = 0.5,
                              sigma_2 = 1,
                              alpha0 = 0.5, alpha1 = 0.1, alpha2 = -0.1, alpha3 = -0.2,
                              n=n, Cens = Cens)
data_test <- OUT1$data0

semicmprskcoxmsm documentation built on April 30, 2022, 1:08 a.m.