data_sim_copula {CopulaCenR} | R Documentation |
Simulate bivariate time-to-event times based on specific copula and marginal distributions
Description
To generate a sample of subjects with two correlated event times based on specific copula and marginal models
Usage
data_sim_copula(n, copula, eta, dist, baseline, var_list, COV_beta, x1, x2)
Arguments
n |
sample size |
copula |
types of copula, including |
eta |
copula parameter |
dist |
marginal distributions, including |
baseline |
marginal distribution parameters.
For |
var_list |
a vector of covariate names; assume the same covariates for two margins |
COV_beta |
a vector of regression coefficients corresponding to |
x1 |
a data frame of covariates for margin 1; it shall have n rows,
with columns corresponding to the |
x2 |
a data frame of covariates for margin 2 |
Details
The parametric generator functions of copula functions are list below:
The Clayton copula has a generator
\phi_{\eta}(t) = (1+t)^{-1/\eta},
with \eta > 0
and Kendall's \tau = \eta/(2+\eta)
.
The Gumbel copula has a generator
\phi_{\eta}(t) = \exp(-t^{1/\eta}),
with \eta \geq 1
and Kendall's \tau = 1 - 1/\eta
.
The Frank copula has a generator
\phi_{\eta}(t) = -\eta^{-1}\log \{1+e^{-t}(e^{-\eta}-1)\},
with \eta \geq 0
and Kendall's \tau = 1+4\{D_1(\eta)-1\}/\eta
,
in which D_1(\eta) = \frac{1}{\eta} \int_{0}^{\eta} \frac{t}{e^t-1}dt
.
The AMH copula has a generator
\phi_{\eta}(t) = (1-\eta)/(e^{t}-\eta),
with \eta \in [0,1)
and Kendall's \tau = 1-2\{(1-\eta)^2 \log (1-\eta) + \eta\}/(3\eta^2)
.
The Joe copula has a generator
\phi_{\eta}(t) = 1-(1-e^{-t})^{1/\eta},
with \eta \geq 1
and Kendall's \tau = 1 - 4 \sum_{k=1}^{\infty} \frac{1}{k(\eta k+2)\{\eta(k-1)+2\}}
.
The marginal survival distributions are listed below:
The Weibull (PH) survival distribution is
\exp \{-(t/\lambda)^k e^{Z^{\top}\beta}\},
with \lambda > 0
as scale and k > 0
as shape.
The Gompertz (PH) survival distribution is
\exp \{-\frac{b}{a}(e^{at}-1) e^{Z^{\top}\beta}\},
with a > 0
as shape and b > 0
as rate
The Loglogistic (PO) survival distribution is
\{1+(t/\lambda)^{k} e^{Z^{\top}\beta} \}^{-1},
with \lambda > 0
as scale and k > 0
as shape.
Value
a data frame of bivariate time-to-event data with covariates
Examples
library(CopulaCenR)
set.seed(1)
dat <- data_sim_copula(n = 500, copula = "Clayton", eta = 3,
dist = "Weibull", baseline = c(0.1,2),
var_list = c("var1", "var2"),
COV_beta = c(0.1, 0.1),
x1 = cbind(rnorm(500, 6, 2),
rbinom(500, 1, 0.5)),
x2 = cbind(rnorm(500, 6, 2),
rbinom(500, 1, 0.5)))
plot(x = dat$time[dat$ind == 1], y = dat$time[dat$ind == 2],
xlab = expression(t[1]), ylab = expression(t[2]),
cex.axis = 1, cex.lab = 1.3)