| Title: | Statistical Methods for Survival Data with Dependent Censoring |
|---|---|
| Description: | Several statistical methods for analyzing survival data under various forms of dependent censoring are implemented in the package. In addition to accounting for dependent censoring, it offers tools to adjust for unmeasured confounding factors. The implemented approaches allow users to estimate the dependency between survival time and dependent censoring time, based solely on observed survival data. For more details on the methods, refer to Deresa and Van Keilegom (2021) <doi:10.1093/biomet/asaa095>, Czado and Van Keilegom (2023) <doi:10.1093/biomet/asac067>, Crommen et al. (2024) <doi:10.1007/s11749-023-00903-9>, Deresa and Van Keilegom (2024) <doi:10.1080/01621459.2022.2161387>, Willems et al. (2025) <doi:10.48550/arXiv.2403.11860>, Ding and Van Keilegom (2025) and D'Haen et al. (2025) <doi:10.1007/s10985-025-09647-0>. |
| Authors: | Ilias Willems [aut] (ORCID: <https://orcid.org/0009-0001-9463-9942>), Gilles Crommen [aut] (ORCID: <https://orcid.org/0000-0001-8380-1900>), Negera Wakgari Deresa [aut, cre] (ORCID: <https://orcid.org/0000-0002-1302-3725>), Jie Ding [aut] (ORCID: <https://orcid.org/0000-0002-6083-7529>), Claudia Czado [aut] (ORCID: <https://orcid.org/0000-0002-6329-5438>), Myrthe D'Haen [aut] (ORCID: <https://orcid.org/0000-0003-0223-0267>), Ingrid Van Keilegom [aut] (ORCID: <https://orcid.org/0000-0001-8827-7642>) |
| Maintainer: | Negera Wakgari Deresa <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.9 |
| Built: | 2026-05-18 09:55:19 UTC |
| Source: | https://github.com/nago2020/depcensoring |
R6 object that mimics a chronometer. It can be started, paused, record legs and stopped.
show()
Display the values stored in this chronometer object.
Chronometer$show()
reset()
Reset the chronometer.
Chronometer$reset()
start()
Start the chronometer
Chronometer$start()
stop()
Stop the chronometer
Chronometer$stop(leg.name = NULL)
leg.name(optional) Name for the stopped leg.
record.leg()
Record a leg time. The chronometer will continue running.
Chronometer$record.leg(leg.name = NULL)
leg.nameName for the recorded leg.
get.chronometer.data()
Like show method, but more rudimentary.
Chronometer$get.chronometer.data()
get.total.time()
Return the total time span between start and stop.
Chronometer$get.total.time(force = FALSE)
forceBoolean variable. If TRUE, avoids error when calling
this function while chronometer has not been stopped yet.
accumulate.legs()
Return total time spent per leg category (using leg names).
Chronometer$accumulate.legs(force = FALSE)
forceforce Boolean variable. If TRUE, avoids error when calling
this function while chronometer has not been stopped yet.
clone()
The objects of this class are cloneable with this method.
Chronometer$clone(deep = FALSE)
deepWhether to make a deep clone.
This function estimates the parameters in the competing risks model described in Willems et al. (2025). Note that this model extends the model of Crommen, Beyhum and Van Keilegom (2024) and as such, this function also implements their methodology.
estimate.cmprsk( data, admin, conf, eoi.indicator.names = NULL, Zbin = NULL, inst = "cf", realV = NULL, compute.var = TRUE, eps = 0.001 )estimate.cmprsk( data, admin, conf, eoi.indicator.names = NULL, Zbin = NULL, inst = "cf", realV = NULL, compute.var = TRUE, eps = 0.001 )
data |
A data frame, adhering to the following formatting rules:
|
admin |
Boolean value indicating whether the data contains administrative censoring. |
conf |
Boolean value indicating whether the data contains confounding
and hence indicating the presence of |
eoi.indicator.names |
Vector of names of the censoring indicator columns
pertaining to events of interest. Events of interest will be modeled allowing
dependence between them, whereas all censoring events (corresponding to
indicator columns not listed in |
Zbin |
Indicator value indicating whether ( |
inst |
Variable encoding which approach should be used for dealing with
the confounding. |
realV |
Vector of numerics with length equal to the number of rows in
|
compute.var |
Boolean value indicating whether the variance of the
parameter estimates should be computed as well (this can be very
computationally intensive, so may want to be disabled). Default is
|
eps |
Value that will be added to the diagonal of the covariance matrix during estimation in order to ensure strictly positive variances. |
A list of parameter estimates in the second stage of the estimation algorithm (hence omitting the estimates for the control function), as well as an estimate of their variance and confidence intervals.
Willems et al. (2025). Flexible control function approach under competing risks (submitted).
Crommen, G., Beyhum, J., and Van Keilegom, I. (2024). An instrumental variable approach under dependent censoring. Test, 33(2), 473-495.
n <- 200 # Set parameters gamma <- c(1, 2, 1.5, -1) theta <- c(0.5, 1.5) eta1 <- c(1, -1, 2, -1.5, 0.5) eta2 <- c(0.5, 1, 1, 3, 0) # Generate exogenous covariates x0 <- rep(1, n) x1 <- rnorm(n) x2 <- rbinom(n, 1, 0.5) # Generate confounder and instrument w <- rnorm(n) V <- rnorm(n, 0, 2) z <- cbind(x0, x1, x2, w) %*% gamma + V realV <- z - (cbind(x0, x1, x2, w) %*% gamma) # Generate event times err <- MASS::mvrnorm(n, mu = c(0, 0), Sigma = matrix(c(3, 1, 1, 2), nrow = 2, byrow = TRUE)) bn <- cbind(x0, x1, x2, z, realV) %*% cbind(eta1, eta2) + err Lambda_T1 <- bn[,1]; Lambda_T2 <- bn[,2] x.ind = (Lambda_T1>0) y.ind <- (Lambda_T2>0) T1 <- rep(0,length(Lambda_T1)) T2 <- rep(0,length(Lambda_T2)) T1[x.ind] = ((theta[1]*Lambda_T1[x.ind]+1)^(1/theta[1])-1) T1[!x.ind] = 1-(1-(2-theta[1])*Lambda_T1[!x.ind])^(1/(2-theta[1])) T2[y.ind] = ((theta[2]*Lambda_T2[y.ind]+1)^(1/theta[2])-1) T2[!y.ind] = 1-(1-(2-theta[2])*Lambda_T2[!y.ind])^(1/(2-theta[2])) # Generate adminstrative censoring time C <- runif(n, 0, 40) # Create observed data set y <- pmin(T1, T2, C) delta1 <- as.numeric(T1 == y) delta2 <- as.numeric(T2 == y) da <- as.numeric(C == y) data <- data.frame(cbind(y, delta1, delta2, da, x0, x1, x2, z, w)) colnames(data) <- c("y", "delta1", "delta2", "da", "x0", "x1", "x2", "z", "w") # Estimate the model admin <- TRUE # There is administrative censoring in the data. conf <- TRUE # There is confounding in the data (z) eoi.indicator.names <- NULL # We will not impose that T1 and T2 are independent Zbin <- FALSE # The confounding variable z is not binary inst <- "cf" # Use the control function approach compute.var <- TRUE # Variance of estimates should be computed. # Since we don't use the oracle estimator, this argument is ignored anyway realV <- NULL estimate.cmprsk(data, admin, conf, eoi.indicator.names, Zbin, inst, realV, compute.var)n <- 200 # Set parameters gamma <- c(1, 2, 1.5, -1) theta <- c(0.5, 1.5) eta1 <- c(1, -1, 2, -1.5, 0.5) eta2 <- c(0.5, 1, 1, 3, 0) # Generate exogenous covariates x0 <- rep(1, n) x1 <- rnorm(n) x2 <- rbinom(n, 1, 0.5) # Generate confounder and instrument w <- rnorm(n) V <- rnorm(n, 0, 2) z <- cbind(x0, x1, x2, w) %*% gamma + V realV <- z - (cbind(x0, x1, x2, w) %*% gamma) # Generate event times err <- MASS::mvrnorm(n, mu = c(0, 0), Sigma = matrix(c(3, 1, 1, 2), nrow = 2, byrow = TRUE)) bn <- cbind(x0, x1, x2, z, realV) %*% cbind(eta1, eta2) + err Lambda_T1 <- bn[,1]; Lambda_T2 <- bn[,2] x.ind = (Lambda_T1>0) y.ind <- (Lambda_T2>0) T1 <- rep(0,length(Lambda_T1)) T2 <- rep(0,length(Lambda_T2)) T1[x.ind] = ((theta[1]*Lambda_T1[x.ind]+1)^(1/theta[1])-1) T1[!x.ind] = 1-(1-(2-theta[1])*Lambda_T1[!x.ind])^(1/(2-theta[1])) T2[y.ind] = ((theta[2]*Lambda_T2[y.ind]+1)^(1/theta[2])-1) T2[!y.ind] = 1-(1-(2-theta[2])*Lambda_T2[!y.ind])^(1/(2-theta[2])) # Generate adminstrative censoring time C <- runif(n, 0, 40) # Create observed data set y <- pmin(T1, T2, C) delta1 <- as.numeric(T1 == y) delta2 <- as.numeric(T2 == y) da <- as.numeric(C == y) data <- data.frame(cbind(y, delta1, delta2, da, x0, x1, x2, z, w)) colnames(data) <- c("y", "delta1", "delta2", "da", "x0", "x1", "x2", "z", "w") # Estimate the model admin <- TRUE # There is administrative censoring in the data. conf <- TRUE # There is confounding in the data (z) eoi.indicator.names <- NULL # We will not impose that T1 and T2 are independent Zbin <- FALSE # The confounding variable z is not binary inst <- "cf" # Use the control function approach compute.var <- TRUE # Variance of estimates should be computed. # Since we don't use the oracle estimator, this argument is ignored anyway realV <- NULL estimate.cmprsk(data, admin, conf, eoi.indicator.names, Zbin, inst, realV, compute.var)
This function allows to estimate the dependency parameter along all other model parameters. First, estimates the cumulative hazard function, and then at the second stage it estimates other model parameters assuming that the cumulative hazard function is known. The details for implementing the dependent censoring methodology can be found in Deresa and Van Keilegom (2024).
fitDepCens( resData, X, W, cop = c("Frank", "Gumbel", "Normal"), dist = c("Weibull", "lognormal"), start = NULL, n.iter = 50, bootstrap = TRUE, n.boot = 150, ncore = 7, eps = 1e-04 )fitDepCens( resData, X, W, cop = c("Frank", "Gumbel", "Normal"), dist = c("Weibull", "lognormal"), start = NULL, n.iter = 50, bootstrap = TRUE, n.boot = 150, ncore = 7, eps = 1e-04 )
resData |
Data matrix with three columns; Z = the observed survival time, d1 = the censoring indicator of T and d2 = the censoring indicator of C. |
X |
Data matrix with covariates related to T. |
W |
Data matrix with covariates related to C. First column of W should be a vector of ones. |
cop |
Which copula should be computed to account for dependency between T and C. This argument can take
one of the values from |
dist |
The distribution to be used for the censoring time C. Only two distributions are allowed, i.e, Weibull
and lognormal distributions. With the value |
start |
Initial values for the finite dimensional parameters. If |
n.iter |
Number of iterations; the default is |
bootstrap |
A boolean indicating whether to compute bootstrap standard errors for making inferences. |
n.boot |
Number of bootstrap samples to use in the estimation of bootstrap standard errors if |
ncore |
The number of cores to use for parallel computation in bootstrapping, with the default |
eps |
Convergence error. This is set by the user in such away that the desired convergence is met; the default is |
This function returns a fit of dependent censoring model; parameter estimates, estimate of the cumulative hazard function, bootstrap standard errors for finite-dimensional parameters, the nonparametric cumulative hazard function, etc.
Deresa and Van Keilegom (2024). Copula based Cox proportional hazards models for dependent censoring, Journal of the American Statistical Association, 119:1044-1054.
# Toy data example to illustrate implementation n = 300 beta = c(0.5) lambd = 0.35 eta = c(0.9,0.4) X = cbind(rbinom(n,1,0.5)) W = cbind(rep(1,n),rbinom(n,1,0.5)) # generate dependency structure from Frank frank.cop <- copula::frankCopula(param = 5,dim = 2) U = copula::rCopula(n,frank.cop) T1 = (-log(1-U[,1]))/(lambd*exp(X*beta)) # Survival time T2 = (-log(1-U[,2]))^(1.1)*exp(W%*%eta) # Censoring time A = runif(n,0,15) # administrative censoring time Z = pmin(T1,T2,A) d1 = as.numeric(Z==T1) d2 = as.numeric(Z==T2) resData = data.frame("Z" = Z,"d1" = d1, "d2" = d2) # should be data frame colnames(W) <- c("ones","cov1") colnames(X) <- "cov.surv" # Fit dependent censoring model fit <- fitDepCens(resData = resData, X = X, W = W, bootstrap = FALSE) # parameter estimates fit$parameterEstimates # summary fit results summary(fit) # plot cumulative hazard vs time plot(fit$observedTime, fit$cumhazardFunction, type = "l",xlab = "Time", ylab = "Estimated cumulative hazard function")# Toy data example to illustrate implementation n = 300 beta = c(0.5) lambd = 0.35 eta = c(0.9,0.4) X = cbind(rbinom(n,1,0.5)) W = cbind(rep(1,n),rbinom(n,1,0.5)) # generate dependency structure from Frank frank.cop <- copula::frankCopula(param = 5,dim = 2) U = copula::rCopula(n,frank.cop) T1 = (-log(1-U[,1]))/(lambd*exp(X*beta)) # Survival time T2 = (-log(1-U[,2]))^(1.1)*exp(W%*%eta) # Censoring time A = runif(n,0,15) # administrative censoring time Z = pmin(T1,T2,A) d1 = as.numeric(Z==T1) d2 = as.numeric(Z==T2) resData = data.frame("Z" = Z,"d1" = d1, "d2" = d2) # should be data frame colnames(W) <- c("ones","cov1") colnames(X) <- "cov.surv" # Fit dependent censoring model fit <- fitDepCens(resData = resData, X = X, W = W, bootstrap = FALSE) # parameter estimates fit$parameterEstimates # summary fit results summary(fit) # plot cumulative hazard vs time plot(fit$observedTime, fit$cumhazardFunction, type = "l",xlab = "Time", ylab = "Estimated cumulative hazard function")
This function allows to estimate all model parameters under the assumption of independent censoring. First, estimates the cumulative hazard function, and then at the second stage it estimates other model parameters assuming that the cumulative hazard is known.
fitIndepCens( resData, X, W, dist = c("Weibull", "lognormal"), start = NULL, n.iter = 50, bootstrap = TRUE, n.boot = 150, ncore = 7, eps = 1e-04 )fitIndepCens( resData, X, W, dist = c("Weibull", "lognormal"), start = NULL, n.iter = 50, bootstrap = TRUE, n.boot = 150, ncore = 7, eps = 1e-04 )
resData |
Data matrix with three columns; Z = the observed survival time, d1 = the censoring indicator of T and d2 = the censoring indicator of C. |
X |
Data matrix with covariates related to T. |
W |
Data matrix with covariates related to C. First column of W should be ones. |
dist |
The distribution to be used for the censoring time C. Only two distributions are allowed, i.e, Weibull
and lognormal distributions. With the value |
start |
Initial values for the finite dimensional parameters. If |
n.iter |
Number of iterations; the default is |
bootstrap |
A boolean indicating whether to compute bootstrap standard errors for making inferences. |
n.boot |
Number of bootstrap samples to use in the estimation of bootstrap standard errors if |
ncore |
The number of cores to use for parallel computation is configurable, with the default |
eps |
Convergence error. This is set by the user in such away that the desired convergence is met; the default is |
This function returns a fit of independent censoring model; parameter estimates, estimate of the cumulative hazard function, bootstrap standard errors for finite-dimensional parameters, the nonparametric cumulative hazard function, etc.
# Toy data example to illustrate implementation n = 300 beta = c(0.5) lambd = 0.35 eta = c(0.9,0.4) X = cbind(rbinom(n,1,0.5)) W = cbind(rep(1,n),rbinom(n,1,0.5)) # generate dependency structure from Frank frank.cop <- copula::frankCopula(param = 5,dim = 2) U = copula::rCopula(n,frank.cop) T1 = (-log(1-U[,1]))/(lambd*exp(X*beta)) # Survival time' T2 = (-log(1-U[,2]))^(1.1)*exp(W%*%eta) # Censoring time A = runif(n,0,15) # administrative censoring time Z = pmin(T1,T2,A) d1 = as.numeric(Z==T1) d2 = as.numeric(Z==T2) resData = data.frame("Z" = Z,"d1" = d1, "d2" = d2) # should be data frame colnames(W) <- c("ones","cov1") colnames(X) <- "cov.surv" # Fit independent censoring model fitI <- fitIndepCens(resData = resData, X = X, W = W, bootstrap = FALSE) # parameter estimates fitI$parameterEstimates # summary fit results summary(fitI) # plot cumulative hazard vs time plot(fitI$observedTime, fitI$cumhazardFunction, type = "l",xlab = "Time", ylab = "Estimated cumulative hazard function")# Toy data example to illustrate implementation n = 300 beta = c(0.5) lambd = 0.35 eta = c(0.9,0.4) X = cbind(rbinom(n,1,0.5)) W = cbind(rep(1,n),rbinom(n,1,0.5)) # generate dependency structure from Frank frank.cop <- copula::frankCopula(param = 5,dim = 2) U = copula::rCopula(n,frank.cop) T1 = (-log(1-U[,1]))/(lambd*exp(X*beta)) # Survival time' T2 = (-log(1-U[,2]))^(1.1)*exp(W%*%eta) # Censoring time A = runif(n,0,15) # administrative censoring time Z = pmin(T1,T2,A) d1 = as.numeric(Z==T1) d2 = as.numeric(Z==T2) resData = data.frame("Z" = Z,"d1" = d1, "d2" = d2) # should be data frame colnames(W) <- c("ones","cov1") colnames(X) <- "cov.surv" # Fit independent censoring model fitI <- fitIndepCens(resData = resData, X = X, W = W, bootstrap = FALSE) # parameter estimates fitI$parameterEstimates # summary fit results summary(fitI) # plot cumulative hazard vs time plot(fitI$observedTime, fitI$cumhazardFunction, type = "l",xlab = "Time", ylab = "Estimated cumulative hazard function")
End stage liver disease data set, as for example analyzed by D'Haen et al. (2025).
liverliver
A data frame with 281 rows and 7 variables:
patient ID.
Survival time.
Censoring indicator.
Age of patient.
Gender of patient (1 - male, 0 - female).
Body mass index.
UK End-stage Liver Disease score. Higher scores indicate more severe disease state.
This function allows to estimate the dependency parameter along all other model parameters. First, estimates a non-parametric transformation function, and then at the second stage it estimates other model parameters assuming that the non-parametric function is known. The details for implementing the dependent censoring methodology can be found in Deresa and Van Keilegom (2021).
NonParTrans( resData, X, W, start = NULL, n.iter = 15, bootstrap = FALSE, n.boot = 50, eps = 0.001 )NonParTrans( resData, X, W, start = NULL, n.iter = 15, bootstrap = FALSE, n.boot = 50, eps = 0.001 )
resData |
Data matrix with three columns; Z = the observed survival time, d1 = the censoring indicator of T and d2 = the censoring indicator of C. |
X |
Data matrix with covariates related to T |
W |
Data matrix with covariates related to C |
start |
Initial values for the finite dimensional parameters. If |
n.iter |
Number of iterations; the default is |
bootstrap |
A boolean indicating whether to compute bootstrap standard errors for making inferences. |
n.boot |
Number of bootstrap samples to use in the estimation of bootstrap standard errors if |
eps |
Convergence error. This is set by the user in such away that the desired convergence is met; the default is |
This function returns a fit of a semiparametric transformation model; parameter estimates, estimate of the non-parametric transformation function, bootstrap standard errors for finite-dimensional parameters, the nonparametric cumulative hazard function, etc.
Deresa, N. and Van Keilegom, I. (2021). On semiparametric modelling, estimation and inference for survival data subject to dependent censoring, Biometrika, 108, 965–979.
# Toy data example to illustrate implementation n = 300 beta = c(0.5, 1); eta = c(1,1.5); rho = 0.70 sigma = matrix(c(1,rho,rho,1),ncol=2) err = MASS::mvrnorm(n, mu = c(0,0) , Sigma=sigma) err1 = err[,1]; err2 = err[,2] x1 = rbinom(n,1,0.5); x2 = runif(n,-1,1) X = matrix(c(x1,x2),ncol=2,nrow=n); W = X # data matrix T1 = X%*%beta+err1 C = W%*%eta+err2 T1 = exp(T1); C = exp(C) A = runif(n,0,8); Y = pmin(T1,C,A) d1 = as.numeric(Y==T1) d2 = as.numeric(Y==C) resData = data.frame("Z" = Y,"d1" = d1, "d2" = d2) # should be data frame colnames(X) = c("X1", "X2") colnames(W) = c("W1","W2") # Bootstrap is false by default output = NonParTrans(resData = resData, X = X, W = W, n.iter = 2) output$parameterEstimates# Toy data example to illustrate implementation n = 300 beta = c(0.5, 1); eta = c(1,1.5); rho = 0.70 sigma = matrix(c(1,rho,rho,1),ncol=2) err = MASS::mvrnorm(n, mu = c(0,0) , Sigma=sigma) err1 = err[,1]; err2 = err[,2] x1 = rbinom(n,1,0.5); x2 = runif(n,-1,1) X = matrix(c(x1,x2),ncol=2,nrow=n); W = X # data matrix T1 = X%*%beta+err1 C = W%*%eta+err2 T1 = exp(T1); C = exp(C) A = runif(n,0,8); Y = pmin(T1,C,A) d1 = as.numeric(Y==T1) d2 = as.numeric(Y==C) resData = data.frame("Z" = Y,"d1" = d1, "d2" = d2) # should be data frame colnames(X) = c("X1", "X2") colnames(W) = c("W1","W2") # Bootstrap is false by default output = NonParTrans(resData = resData, X = X, W = W, n.iter = 2) output$parameterEstimates
Note that it is not assumed that the association parameter of the copula function is known, unlike most other papers in the literature. The details for implementing the methodology can be found in Czado and Van Keilegom (2023).
ParamCop(Y, Delta, Copula, Dist.T, Dist.C, start = c(1, 1, 1, 1))ParamCop(Y, Delta, Copula, Dist.T, Dist.C, start = c(1, 1, 1, 1))
Y |
Follow-up time. |
Delta |
Censoring indicator. |
Copula |
The copula family. This argument can take values from |
Dist.T |
The distribution to be used for the survival time T. This argument can take one of the values from |
Dist.C |
The distribution to be used for the censoring time C. This argument can take one of the values from |
start |
Starting values. |
A table containing the minimized negative log-likelihood using the independence copula model, the estimated parameter values for the model with the independence copula, the minimized negative log-likelihood using the specified copula model and the estimated parameter values for the model with the specified copula.
Czado and Van Keilegom (2023). Dependent censoring based on parametric copulas. Biometrika, 110(3), 721-738.
tau = 0.75 Copula = "frank" Dist.T = "weibull" Dist.C = "lnorm" par.T = c(2,1) par.C = c(1,2) n=1000 simdata<-TCsim(tau,Copula,Dist.T,Dist.C,par.T,par.C,n) Y = simdata[[1]] Delta = simdata[[2]] ParamCop(Y,Delta,Copula,Dist.T,Dist.C)tau = 0.75 Copula = "frank" Dist.T = "weibull" Dist.C = "lnorm" par.T = c(2,1) par.C = c(1,2) n=1000 simdata<-TCsim(tau,Copula,Dist.T,Dist.C,par.T,par.C,n) Y = simdata[[1]] Delta = simdata[[2]] ParamCop(Y,Delta,Copula,Dist.T,Dist.C)
This function estimates bounds on the coefficients the single-
index model for the conditional cumulative
distribution function of the event time.
pi.surv( data, idx.param.of.interest, idxs.c, t, par.space, search.method = "GS", add.options = list(), verbose = 0, picturose = FALSE, parallel = FALSE )pi.surv( data, idx.param.of.interest, idxs.c, t, par.space, search.method = "GS", add.options = list(), verbose = 0, picturose = FALSE, parallel = FALSE )
data |
Data frame containing the data on which to fit the model. The columns should be named as follows: 'Y' = observed timed, 'Delta' = censoring indicators, 'X0' = intercept column, 'X1' - 'Xp' = covariates. |
idx.param.of.interest |
Index of element in the covariate vector for
which the identified interval should be estimated. It can also be specified
as |
idxs.c |
Vector of indices of the continuous covariates. Suppose the
given data contains 5 covariates, of which 'X2' and 'X5' are continuous, this
argument should be specified as |
t |
Time point for which to estimate the identified set of
|
par.space |
Matrix containing bounds on the space of the parameters. The first column corresponds to lower bounds, the second to upper bounds. The i'th row corresponds to the bounds on the i'th element in the parameter vector. |
search.method |
The search method to be used to find the identified
interval. Default is |
add.options |
List of additional options to be specified to the method.
Notably, it can be used to select the link function General hyperparameters:
Hyperparameters specific to the EAM implementation:
Hyperparameters specific to the gridsearch implementation:
Other (hidden) options can also be overwritten, though we highly discourage
this. If necessary, you can consult the source code of this functions to
find the names of the desired parameters and add their name alongside their
desired value as an entry in |
verbose |
Verbosity level. The higher the value, the more verbose the
method will be. Default is |
picturose |
Picturosity flag. If |
parallel |
Flag for whether or not parallel computing should be used.
Default is |
Matrix containing the identified intervals of the specified coefficients, as well as corresponding convergence information of the estimation algorithm.
Willems, I., Beyhum, J. and Van Keilegom, I. (2025). Partial identification for a class of survival models under dependent censoring. (Submitted).
# Clear workspace rm(list = ls()) # Load the survival package library(survival) # Set random seed set.seed(123) # Load and preprocess data data <- survival::lung data[, "intercept"] <- rep(1, nrow(data)) data[, "status"] <- data[, "status"] - 1 data <- data[, c("time", "status", "intercept", "age", "sex")] colnames(data) <- c("Y", "Delta", "X0", "X1", "X2") # Standardize age variable data[, "X1"] <- scale(data[, "X1"]) ## Example: ## - Link function: AFT link function (default setting) ## - Number of IF: 5 IF per continuous covariate (default setting) ## - Search method: Binary search ## - Type of IF: Cubic spline functions for continuous covariate, indicator ## function for discrete covariate (default setting). # Settings for main estimation function idx.param.of.interest <- 2 # Interest in effect of age idxs.c <- 1 # X1 (age) is continuous t <- 200 # Model imposed at t = 200 search.method <- "GS" # Use binary search par.space <- matrix(rep(c(-10, 10), 3), nrow = 3, byrow = TRUE) add.options <- list() picturose <- TRUE parallel <- FALSE # Estimate the identified intervals pi.surv(data, idx.param.of.interest, idxs.c, t, par.space, search.method = search.method, add.options = add.options, picturose = picturose, parallel = parallel)# Clear workspace rm(list = ls()) # Load the survival package library(survival) # Set random seed set.seed(123) # Load and preprocess data data <- survival::lung data[, "intercept"] <- rep(1, nrow(data)) data[, "status"] <- data[, "status"] - 1 data <- data[, c("time", "status", "intercept", "age", "sex")] colnames(data) <- c("Y", "Delta", "X0", "X1", "X2") # Standardize age variable data[, "X1"] <- scale(data[, "X1"]) ## Example: ## - Link function: AFT link function (default setting) ## - Number of IF: 5 IF per continuous covariate (default setting) ## - Search method: Binary search ## - Type of IF: Cubic spline functions for continuous covariate, indicator ## function for discrete covariate (default setting). # Settings for main estimation function idx.param.of.interest <- 2 # Interest in effect of age idxs.c <- 1 # X1 (age) is continuous t <- 200 # Model imposed at t = 200 search.method <- "GS" # Use binary search par.space <- matrix(rep(c(-10, 10), 3), nrow = 3, byrow = TRUE) add.options <- list() picturose <- TRUE parallel <- FALSE # Estimate the identified intervals pi.surv(data, idx.param.of.interest, idxs.c, t, par.space, search.method = search.method, add.options = add.options, picturose = picturose, parallel = parallel)
This function estimates the parameters in the model of D'Haen et al. (2025).
QRdepCens(data, hp, var.estimate = FALSE, verbose = TRUE)QRdepCens(data, hp, var.estimate = FALSE, verbose = TRUE)
data |
Data on which the model should be estimated. Note that the data
should be structured in a specific form: The observed times should be put in
a column named |
hp |
List of hyperparameters to be used, the elements of which will overwrite the default settings. In particular, consider changing:
Other hyperparameters can be changed though it is not recommended. We refer to the source code for the available options. |
var.estimate |
Boolean value indicating whether the variance should be
estimated (via bootstrap). This can take a considerable amount of time.
Default is |
verbose |
Verbosity flag (boolean) indicating whether the results should
be printed to the console. Default is |
The variance estimation procedure could easily be paralelized. However, this is currently not implemented.
D'Haen, M., Van Keilegom, I. and Verhasselt, A. (2025). Quantile regression under dependent censoring with unknown association. Lifetime Data Analysis 31(2):253-299.
# Load the data data(liver) # Give standard column names (required!) colnames(liver) <- c("patient", "Y", "Delta", "X1", "X2", "X3", "X4") liver <- liver[, c(-1, -6, -7)] # Run the model hp <- list( homoscedastic = FALSE, test_cop_name = "frank" ) QRdepCens(liver, hp, var.estimate = FALSE) # Takes a while if var.estimate = TRUE...# Load the data data(liver) # Give standard column names (required!) colnames(liver) <- c("patient", "Y", "Delta", "X1", "X2", "X3", "X4") liver <- liver[, c(-1, -6, -7)] # Run the model hp <- list( homoscedastic = FALSE, test_cop_name = "frank" ) QRdepCens(liver, hp, var.estimate = FALSE) # Takes a while if var.estimate = TRUE...
This function estimates the cumulative hazard function of survival time (T) under dependent censoring (C). The estimation makes use of the estimating equations derived based on martingale ideas.
SolveL( theta, resData, X, W, cop = c("Frank", "Gumbel", "Normal"), dist = c("Weibull", "lognormal") )SolveL( theta, resData, X, W, cop = c("Frank", "Gumbel", "Normal"), dist = c("Weibull", "lognormal") )
theta |
Estimated parameter values/initial values for finite dimensional parameters |
resData |
Data matrix with three columns; Z = the observed survival time, d1 = the censoring indicator of T and d2 = the censoring indicator of C. |
X |
Data matrix with covariates related to T |
W |
Data matrix with covariates related to C. First column of W should be ones |
cop |
Which copula should be computed to account for dependency between T and C. This argument can take
one of the values from |
dist |
The distribution to be used for the dependent censoring C. Only two distributions are allowed, i.e, Weibull
and lognormal distributions. With the value |
This function returns an estimated hazard function, cumulative hazard function and distinct observed survival times;
n = 200 beta = c(0.5) lambd = 0.35 eta = c(0.9,0.4) X = cbind(rbinom(n,1,0.5)) W = cbind(rep(1,n),rbinom(n,1,0.5)) frank.cop <- copula::frankCopula(param = 5,dim = 2) U = copula::rCopula(n,frank.cop) T1 = (-log(1-U[,1]))/(lambd*exp(X*beta)) # Survival time' T2 = (-log(1-U[,2]))^(1.1)*exp(W%*%eta) # Censoring time A = runif(n,0,15) # administrative censoring time Z = pmin(T1,T2,A) d1 = as.numeric(Z==T1) d2 = as.numeric(Z==T2) resData = data.frame("Z" = Z,"d1" = d1, "d2" = d2) theta = c(0.3,1,0.3,1,2) # Estimate cumulative hazard function cumFit <- SolveL(theta, resData,X,W) cumhaz = cumFit$cumhaz time = cumFit$times # plot hazard vs time plot(time, cumhaz, type = "l",xlab = "Time", ylab = "Estimated cumulative hazard function")n = 200 beta = c(0.5) lambd = 0.35 eta = c(0.9,0.4) X = cbind(rbinom(n,1,0.5)) W = cbind(rep(1,n),rbinom(n,1,0.5)) frank.cop <- copula::frankCopula(param = 5,dim = 2) U = copula::rCopula(n,frank.cop) T1 = (-log(1-U[,1]))/(lambd*exp(X*beta)) # Survival time' T2 = (-log(1-U[,2]))^(1.1)*exp(W%*%eta) # Censoring time A = runif(n,0,15) # administrative censoring time Z = pmin(T1,T2,A) d1 = as.numeric(Z==T1) d2 = as.numeric(Z==T2) resData = data.frame("Z" = Z,"d1" = d1, "d2" = d2) theta = c(0.3,1,0.3,1,2) # Estimate cumulative hazard function cumFit <- SolveL(theta, resData,X,W) cumhaz = cumFit$cumhaz time = cumFit$times # plot hazard vs time plot(time, cumhaz, type = "l",xlab = "Time", ylab = "Estimated cumulative hazard function")
This function estimates the cumulative hazard function of survival time (T) under the assumption of independent censoring. The estimating equation is derived based on martingale ideas.
SolveLI(theta, resData, X)SolveLI(theta, resData, X)
theta |
Estimated parameter values/initial values for finite dimensional parameters |
resData |
Data matrix with three columns; Z = the observed survival time, d1 = the censoring indicator of T and d2 = the censoring indicator of C. |
X |
Data matrix with covariates related to T |
This function returns an estimated hazard function, cumulative hazard function and distinct observed survival times;
n = 200 beta = c(0.5) lambd = 0.35 eta = c(0.9,0.4) X = cbind(rbinom(n,1,0.5)) W = cbind(rep(1,n),rbinom(n,1,0.5)) frank.cop <- copula::frankCopula(param = 5,dim = 2) U = copula::rCopula(n,frank.cop) T1 = (-log(1-U[,1]))/(lambd*exp(X*beta)) # Survival time' T2 = (-log(1-U[,2]))^(1.1)*exp(W%*%eta) # Censoring time A = runif(n,0,15) # administrative censoring time Z = pmin(T1,T2,A) d1 = as.numeric(Z==T1) d2 = as.numeric(Z==T2) resData = data.frame("Z" = Z,"d1" = d1, "d2" = d2) theta = c(0.3,1,0.3,1) # Estimate cumulative hazard function cumFit_ind <- SolveLI(theta, resData,X) cumhaz = cumFit_ind$cumhaz time = cumFit_ind$times # plot hazard vs time plot(time, cumhaz, type = "l",xlab = "Time", ylab = "Estimated cumulative hazard function")n = 200 beta = c(0.5) lambd = 0.35 eta = c(0.9,0.4) X = cbind(rbinom(n,1,0.5)) W = cbind(rep(1,n),rbinom(n,1,0.5)) frank.cop <- copula::frankCopula(param = 5,dim = 2) U = copula::rCopula(n,frank.cop) T1 = (-log(1-U[,1]))/(lambd*exp(X*beta)) # Survival time' T2 = (-log(1-U[,2]))^(1.1)*exp(W%*%eta) # Censoring time A = runif(n,0,15) # administrative censoring time Z = pmin(T1,T2,A) d1 = as.numeric(Z==T1) d2 = as.numeric(Z==T2) resData = data.frame("Z" = Z,"d1" = d1, "d2" = d2) theta = c(0.3,1,0.3,1) # Estimate cumulative hazard function cumFit_ind <- SolveLI(theta, resData,X) cumhaz = cumFit_ind$cumhaz time = cumFit_ind$times # plot hazard vs time plot(time, cumhaz, type = "l",xlab = "Time", ylab = "Estimated cumulative hazard function")
depCensoringFit objectSummary of depCensoringFit object
## S3 method for class 'depFit' summary(object, ...)## S3 method for class 'depFit' summary(object, ...)
object |
Output of |
... |
Further arguments |
Summary of dependent censoring model fit in the form of table
indepCensoringFit objectSummary of indepCensoringFit object
## S3 method for class 'indepFit' summary(object, ...)## S3 method for class 'indepFit' summary(object, ...)
object |
Output of |
... |
Further arguments |
Summary of independent censoring model fit in the form of table
Provide semiparametric approaches that can be used to model right-censored survival data under dependent censoring (without covariates). The copula-based approach is adopted and there is no need to explicitly specify the association parameter. One of the margins can be modeled nonparametrically. As a byproduct, both marginal distributions of survival and censoring times can be considered as fully parametric. The existence of a cured fraction concerning survival time can also be taken into consideration.
@references Czado and Van Keilegom (2023). Dependent censoring based on parametric copulas. Biometrika, 110(3), 721-738. @references Delhelle and Van Keilegom (2024). Copula based dependent censoring in cure models. TEST (to appear). @references Ding and Van Keilegom (2024). Semiparametric estimation of the survival function under dependent censoring (in preparation).
SurvDC( yobs, delta, tm = NULL, copfam = "frank", margins = list(survfam = NULL, censfam = "lnorm"), cure = FALSE, Var = list(do = TRUE, nboot = 200, level = 0.05), control = list(maxit = 300, eps = 1e-06, trace = TRUE, ktau.inits = NULL) )SurvDC( yobs, delta, tm = NULL, copfam = "frank", margins = list(survfam = NULL, censfam = "lnorm"), cure = FALSE, Var = list(do = TRUE, nboot = 200, level = 0.05), control = list(maxit = 300, eps = 1e-06, trace = TRUE, ktau.inits = NULL) )
yobs |
a numeric vector that indicated the observed survival times. |
delta |
a numeric vector that stores the right-censoring indicators. |
tm |
a numeric vector that contains interested non-negative time points at which the survival probabilities will be evluated.
Note that if we omit the definition of this argument (the default value becomes |
copfam |
a character string that specifies the copula family.
Currently, it supports Archimedean copula families, including |
margins |
a list used to define the distribution structures of both the survival and censoring margins. Specifically, it contains the following elements:
Note if one of the marginal distributions should be modeled nonparametrically, one can let the corresponding argument to be |
cure |
a logical value that indicates whether the existence of a cured fraction should be considered. |
Var |
a list that controls the execution of the bootstrap for variance estimation,
and it contains two elements:
|
control |
indicates more detailed control of the underlying model fitting procedures. It is a list of the following three arguments:
|
This unified function provide approaches that can be used to model right-censored survival data under dependent censoring (without covariates). Various specifications of marginal distributions can be considered by choosing different combinations of the provided arguments. Generally speaking, the following two scenarios are what we mainly focused on:
nonparametric survival margin and parametric censoring margin (without cure)survfam = NULL, censfam is not NULL and cure = FALSE.
nonparametric survival margin and parametric censoring margin (with cure)survfam = NULL, censfam is not NULL and cure = TRUE.
As byproducts, several other scenarios (the distribution of the underlying survival time is not nonparametric but fully parametric) can also be considered by this R function:
parametric survival and censoring margins (without cure)both survfam and censfam are not NULL and cure = FALSE.
parametric survival and censoring margins (with cure)both survfam and censfam are not NULL and cure = TRUE.
parametric survival margin and nonparametric censoring margin (without cure)survfam is not NULL, censfam = NULL and cure = FALSE.
Furthermore, one might expect that a scenario with "parametric survival margin and nonparametric censoring margin
(with cure)" can also be included. Indeed, it can be done based on: survfam is not NULL, censfam = NULL
and cure = TRUE. However, from a theoretical perspective of view, whether this type of modeling is reasonable or not
still needs further investigations.
We emphasize that the first scenario (in byproducts) has also be considered in another function of this package.
Specifically, the scenario of "parametric survival margin and nonparametric censoring margin (without cure)" can be
fitted based on ParamCop(). However, the default joint modeling of survival and censoring times are based on
their joint survival function in line with the semiparametric case (instead of modeling joint distribution function
directly as in Czado and Van Keilegom (2023) <doi:10.1093/biomet/asac067>), but the idea of estimation methodology
are exactly the same.
A list of fitted results is returned. Within this outputted list, the following elements can be found:
probssurvival probabilities of the survial margin at tm.
ktauKendall's tau.
paraparestimation of all parameters (except Kendall's tau) contained in the parametric part.
GoFgoodness-of-test results.
cureratecure rate. If cure = FALSE, it is NULL.
#----------------------------------------------------------# # Basic preparations before running subsequent examples #### #----------------------------------------------------------# # library necessary packages #------------------------------------------------------------------------# # simulated data from Frank copula log-Normal margins (without cure) #------------------------------------------------------------------------# # generate the simulated data # - the sample size of the generated data n <- 1000 # information on the used copula copfam.true <- "frank" ktau.true <- 0.5 coppar.true <- 5.74 # parameters of the underlying log-normal marginal distributions survpar.true <- c(2.20,1.00) censpar.true <- c(2.20,0.25) # - true underlying survival and censoring times set.seed(1) u.TC <- copula::rCopula( n = n, copula = copula::archmCopula( family = copfam.true, param = coppar.true, dim = 2 ) ) yobs.T <- qlnorm(1-u.TC[,1],survpar.true[1],survpar.true[2]) yobs.C <- qlnorm(1-u.TC[,2],censpar.true[1],censpar.true[2]) # observations yobs <- pmin(yobs.T,yobs.C) delta <- as.numeric(yobs.T<=yobs.C) cat("censoring rate is", mean(1-delta)) # model the data under different scenarios # scenario 1: nonparametric survival margin and parametric censoring margin set.seed(1) sol.scenario1 <- SurvDC( yobs = yobs, delta = delta, tm = quantile(yobs, c(0.25,0.50,0.75)), copfam = copfam.true, margins = list(survfam = NULL, censfam = "lnorm"), Var = list(do = FALSE, nboot = 50) ) sol.scenario1$probs sol.scenario1$ktau sol.scenario1$parapar # scenario 2: parametric survival and censoring margins set.seed(1) sol.scenario2 <- SurvDC( yobs = yobs, delta = delta, tm = quantile(yobs, c(0.25,0.50,0.75)), copfam = copfam.true, margins = list(survfam = "lnorm", censfam = "lnorm"), Var = list(do = FALSE, nboot = 50) ) sol.scenario2$probs sol.scenario2$ktau sol.scenario2$parapar # scenario 3: parametric survival margin and nonparametric censoring margin set.seed(1) sol.scenario3 <- SurvDC( yobs = yobs, delta = delta, tm = quantile(yobs, c(0.25,0.50,0.75)), copfam = copfam.true, margins = list(survfam = "lnorm", censfam = NULL), Var = list(do = FALSE, nboot = 50) ) sol.scenario3$probs sol.scenario3$ktau sol.scenario3$parapar #------------------------------------------------------------------------ # simulated data from Frank copula log-Normal margins (with cure) #------------------------------------------------------------------------ # generate the simulated data # true underlying cure rate curerate.true <- 0.2 # true underlying survival and censoring times set.seed(1) u.TC <- copula::rCopula( n = n, copula = copula::archmCopula( family = copfam.true, param = coppar.true, dim = 2 ) ) yobs.T <- sapply(u.TC[,1],function(uT){ if(uT<=curerate.true){ val <- Inf }else{ val <- EnvStats::qlnormTrunc((1-uT)/(1-curerate.true),survpar.true[1],survpar.true[2],0,15) } return(val) }) yobs.C <- qlnorm(1-u.TC[,2],censpar.true[1],censpar.true[2]) cat("cure rate is",mean(yobs.T==Inf)) # observations yobs <- pmin(yobs.T,yobs.C) delta <- as.numeric(yobs.T<=yobs.C) cat("censoring rate is",mean(1-delta)) # model the data under different scenarios (with cure) # scenario 4: parametric survival and censoring margins set.seed(1) sol.scenario4 <- SurvDC( yobs = yobs, delta = delta, tm = quantile(yobs, c(0.25,0.50,0.75)), copfam = copfam.true, margins = list(survfam = "lnorm", censfam = "lnorm"), Var = list(do = FALSE, nboot = 50), cure = TRUE ) sol.scenario4$probs sol.scenario4$ktau sol.scenario4$parapar sol.scenario4$curerate # scenario 5: nonparametric survival margin and parametric censoring margin set.seed(1) sol.scenario5 <- SurvDC( yobs = yobs, delta = delta, tm = quantile(yobs, c(0.25,0.50,0.75)), copfam = copfam.true, margins = list(survfam = NULL, censfam = "lnorm"), Var = list(do = FALSE, nboot = 50), cure = TRUE ) sol.scenario5$probs sol.scenario5$ktau sol.scenario5$parapar sol.scenario5$curerate#----------------------------------------------------------# # Basic preparations before running subsequent examples #### #----------------------------------------------------------# # library necessary packages #------------------------------------------------------------------------# # simulated data from Frank copula log-Normal margins (without cure) #------------------------------------------------------------------------# # generate the simulated data # - the sample size of the generated data n <- 1000 # information on the used copula copfam.true <- "frank" ktau.true <- 0.5 coppar.true <- 5.74 # parameters of the underlying log-normal marginal distributions survpar.true <- c(2.20,1.00) censpar.true <- c(2.20,0.25) # - true underlying survival and censoring times set.seed(1) u.TC <- copula::rCopula( n = n, copula = copula::archmCopula( family = copfam.true, param = coppar.true, dim = 2 ) ) yobs.T <- qlnorm(1-u.TC[,1],survpar.true[1],survpar.true[2]) yobs.C <- qlnorm(1-u.TC[,2],censpar.true[1],censpar.true[2]) # observations yobs <- pmin(yobs.T,yobs.C) delta <- as.numeric(yobs.T<=yobs.C) cat("censoring rate is", mean(1-delta)) # model the data under different scenarios # scenario 1: nonparametric survival margin and parametric censoring margin set.seed(1) sol.scenario1 <- SurvDC( yobs = yobs, delta = delta, tm = quantile(yobs, c(0.25,0.50,0.75)), copfam = copfam.true, margins = list(survfam = NULL, censfam = "lnorm"), Var = list(do = FALSE, nboot = 50) ) sol.scenario1$probs sol.scenario1$ktau sol.scenario1$parapar # scenario 2: parametric survival and censoring margins set.seed(1) sol.scenario2 <- SurvDC( yobs = yobs, delta = delta, tm = quantile(yobs, c(0.25,0.50,0.75)), copfam = copfam.true, margins = list(survfam = "lnorm", censfam = "lnorm"), Var = list(do = FALSE, nboot = 50) ) sol.scenario2$probs sol.scenario2$ktau sol.scenario2$parapar # scenario 3: parametric survival margin and nonparametric censoring margin set.seed(1) sol.scenario3 <- SurvDC( yobs = yobs, delta = delta, tm = quantile(yobs, c(0.25,0.50,0.75)), copfam = copfam.true, margins = list(survfam = "lnorm", censfam = NULL), Var = list(do = FALSE, nboot = 50) ) sol.scenario3$probs sol.scenario3$ktau sol.scenario3$parapar #------------------------------------------------------------------------ # simulated data from Frank copula log-Normal margins (with cure) #------------------------------------------------------------------------ # generate the simulated data # true underlying cure rate curerate.true <- 0.2 # true underlying survival and censoring times set.seed(1) u.TC <- copula::rCopula( n = n, copula = copula::archmCopula( family = copfam.true, param = coppar.true, dim = 2 ) ) yobs.T <- sapply(u.TC[,1],function(uT){ if(uT<=curerate.true){ val <- Inf }else{ val <- EnvStats::qlnormTrunc((1-uT)/(1-curerate.true),survpar.true[1],survpar.true[2],0,15) } return(val) }) yobs.C <- qlnorm(1-u.TC[,2],censpar.true[1],censpar.true[2]) cat("cure rate is",mean(yobs.T==Inf)) # observations yobs <- pmin(yobs.T,yobs.C) delta <- as.numeric(yobs.T<=yobs.C) cat("censoring rate is",mean(1-delta)) # model the data under different scenarios (with cure) # scenario 4: parametric survival and censoring margins set.seed(1) sol.scenario4 <- SurvDC( yobs = yobs, delta = delta, tm = quantile(yobs, c(0.25,0.50,0.75)), copfam = copfam.true, margins = list(survfam = "lnorm", censfam = "lnorm"), Var = list(do = FALSE, nboot = 50), cure = TRUE ) sol.scenario4$probs sol.scenario4$ktau sol.scenario4$parapar sol.scenario4$curerate # scenario 5: nonparametric survival margin and parametric censoring margin set.seed(1) sol.scenario5 <- SurvDC( yobs = yobs, delta = delta, tm = quantile(yobs, c(0.25,0.50,0.75)), copfam = copfam.true, margins = list(survfam = NULL, censfam = "lnorm"), Var = list(do = FALSE, nboot = 50), cure = TRUE ) sol.scenario5$probs sol.scenario5$ktau sol.scenario5$parapar sol.scenario5$curerate
Generates the follow-up time and censoring indicator according to the specified model.
TCsim( tau = 0, Copula = "frank", Dist.T = "lnorm", Dist.C = "lnorm", par.T = c(0, 1), par.C = c(0, 1), n = 10000 )TCsim( tau = 0, Copula = "frank", Dist.T = "lnorm", Dist.C = "lnorm", par.T = c(0, 1), par.C = c(0, 1), n = 10000 )
tau |
Value of Kendall's tau for (T,C). The default value is 0. |
Copula |
The copula family. This argument can take values from |
Dist.T |
Distribution of the survival time T. This argument can take one of the values from |
Dist.C |
Distribution of the censoring time C. This argument can take one of the values from |
par.T |
Parameter values for the distribution of T. |
par.C |
Parameter values for the distribution of C. |
n |
Sample size. |
A list containing the generated follow-up times and censoring indicators.
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)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)