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
with and Kendall's
.
The Gumbel copula has a generator
with and Kendall's
.
The Frank copula has a generator
with and Kendall's
,
in which
.
The AMH copula has a generator
with and Kendall's
.
The Joe copula has a generator
with and Kendall's
.
The marginal survival distributions are listed below:
The Weibull (PH) survival distribution is
with as scale and
as shape.
The Gompertz (PH) survival distribution is
with as shape and
as rate
The Loglogistic (PO) survival distribution is
with as scale and
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)