# NOT RUN {
## Generate simulated data from a transformation model
datgen <- function(n) {
a <- -0.3
X <- rweibull(n, 2, 4) ## failure times
U <- rweibull(n, 2, 1) ## latent truncation time
T <- (1 + a) * U - a * X ## apply transformation
C <- 10 ## censoring
dat <- data.frame(trun = T, obs = pmin(X, C), delta = 1 * (X <= C))
return(subset(dat, trun <= obs))
}
set.seed(123)
dat <- datgen(300)
fit <- with(dat, trSurvfit(trun, obs, delta))
fit
## Checking the transformation parameter
fit$byTau$par
fit$byTau$obj
with(dat, condKendall(trun, obs, delta, method = "IPW2", a = fit$byTau$par[1]))$PE
fit$byP$par
fit$byP$obj
with(dat, condKendall(trun, obs, delta, method = "IPW2", a = fit$byP$par[1]))$p.value
# }
Run the code above in your browser using DataLab