I need to simulate data from a cox model with specified values of the parameters: $$\lambda_0(t)exp(X \beta)$$
For reasons I don't want to get into, the scale of my X's is very large. They range between 0 and 100. When I apply the algorithm of Bender et. all (2005) explained very well in this post on Cross Validated, I cannot get reasonable parameter estimates. I believe it is because the denominator of the expression,
$$T = S^{-1}(V \,|\, \mathbf{x}) = H_0^{-1} \left( - \frac{\log(V)}{\exp(\mathbf{x}^\prime \mathbf{\beta})} \right)$$
becomes very large and forces $- \frac{\log(V)}{\exp(\mathbf{x}^\prime \mathbf{\beta})}$ to 0.
Here's the example code, shamelessly ripped from user ocram:
# baseline hazard: Weibull
# N = sample size
# lambda = scale parameter in h0()
# rho = shape parameter in h0()
# beta = fixed effect parameter
simulWeib <- function(N, lambda, rho, beta){
# covariate --> N Bernoulli trials
x <- runif(N, 0, 1)# , size = 1, prob = .5)
# Weibull event times
v <- runif(N)
Tlat <- (- log(v) / (lambda * exp(beta * x)))^(1 / rho) # Inverse Weibull cdf
# data set
return(data.frame(id=1:N,
time=Tlat,
x=x))
}
Along with the subsequent test to see how well beta is estimated:
set.seed(1)
coefs = rep(0, times = 1e3)
for(k in 1:1e3){
dat <- simulWeib(N=100, lambda=0.01, rho=1,
beta = 2)
fit <- coxph(Surv(time) ~ x, data=dat)
coefs[k] <- fit$coef
}
I get an estimate of around 0.015. I can get very precise estimate when the scale of $X^{\prime} \beta$ is smaller.
So is there any way to simulate from a cox PH model with a large X, or equivalently large $\beta$?