Learn R Programming

depCensoring (version 0.1.7)

TCsim: Function to simulate (Y,Delta) from the copula based model for (T,C).

Description

Generates the follow-up time and censoring indicator according to the specified model.

Usage

TCsim(
  tau = 0,
  Copula = "frank",
  Dist.T = "lnorm",
  Dist.C = "lnorm",
  par.T = c(0, 1),
  par.C = c(0, 1),
  n = 10000
)

Value

A list containing the generated follow-up times and censoring indicators.

Arguments

tau

Value of Kendall's tau for (T,C). The default value is 0.

Copula

The copula family. This argument can take values from c("frank","gumbel","clayton","gaussian","indep"). The default copula model is "frank".

Dist.T

Distribution of the survival time T. This argument can take one of the values from c("lnorm", "weibull", "llogis"). The default distribution is "lnorm".

Dist.C

Distribution of the censoring time C. This argument can take one of the values from c("lnorm", "weibull", "llogis"). The default distribution is "lnorm".

par.T

Parameter values for the distribution of T.

par.C

Parameter values for the distribution of C.

n

Sample size.

Examples

Run this code
tau = 0.5
Copula = "gaussian"
Dist.T = "lnorm"
Dist.C = "lnorm"
par.T = c(1,1)
par.C = c(2,2)
n=1000

simdata <- TCsim(tau,Copula,Dist.T,Dist.C,par.T,par.C,n)
Y = simdata[[1]]
Delta = simdata[[2]]
hist(Y)
mean(Delta)

Run the code above in your browser using DataLab