Generate lefttruncated (and rightcencored) data from the Cox model.
Description
Various baseline survival functions and truncation distribution are
available. Censoring rate can be designated through tuning the parameter
Cmax
; Cmas = Inf
means no censoring.
Usage
1 2 3 4 
Arguments
n 
the sample size. 
b 
a numeric vector for true regression coefficients. 
time.dep 
logical, whether there is the timedependent covariate (only one indicator function Zv = I(t >= zeta) is supported); the default is FALSE. 
Zv.depA 
logical, whether the timedependent covariate 
distr.T 
the baseline survival time (T*) distribution ("exp" or "weibull"). 
shape.T 
the shape parameter for the Weibull distribution of T*. 
scale.T 
the scale parameter for the Weibull distributiof of T*. 
meanlog.T 
the mean for the lognormal distribution of T*. 
sdlog.T 
the sd for the lognormal distribution of T*. 
distr.A 
the baseline truncation time (A*) distribution: either of

shape.A 
the shape parameter for the Weibull distribution of A*. 
scale.A 
the scale parameter for the Weibull distribution of A*. 
p.A 
the success probability for the binomial distribution of A*. 
Cmax 
the upper bound of the uniform distribution of the censoring time (C). 
fix.seed 
an optional random seed for simulation. 
Value
a list with a data.frame containing the observed survival times
(Ys
), the observed truncation times (As
), the event indicator
(Ds
) and the covariates (Zs
); a vector of certain quantiles
of Ys (taus
); the censoring proportion (PC
) and the
truncation proportiona (PT
).
Examples
1 2 3 4 5 6 7 8 9 10  # With timeinvariant covariates only
sim1 = sim.ltrc(n = 100)
head(sim1$dat)
# With one timedependent covariate
sim2 = sim.ltrc(n = 100, time.dep = TRUE,
distr.A = "binomial", p.A = 0.8, Cmax = 5)
head(sim2$dat)
# With one timedependent covariate with dependence on the truncation time
sim3 = sim.ltrc(n = 100, time.dep = TRUE, Zv.depA = TRUE, Cmax = 5)
head(sim3$dat)
