1
$\begingroup$

I recently use the R "sim.survdata" function in "coxed" package to simulate survival data. I did 2k simulations with one covariate and coefficient = 1. Each time I fitted a Cox regression and recorded the estimated beta and 95% CI. However the mean(betahat) doesn't equal to 1, and CIs do not cover 1 at 95% times. Please see the codes I used below. I wonder the reasons, any input is welcomed. Thank you in advance.

bhat=NULL
lb=NULL
ub=NULL
for(i in 1:2000){
set.seed(20110312+i)
simdata <- sim.survdata(N=2633, T=200, xvars=1, censor=.85, num.data.frames = 1, beta = 1)
simdata$data$event=as.numeric(simdata$data$failed)
fit=coxph(Surv(y,event==1)~X,data=simdata$data)
bhat=c(bhat,summary(fit)$coefficients[1])
lb=c(lb,log(summary(fit)$conf.int[3]))
ub=c(ub,log(summary(fit)$conf.int[4]))
}

> mean(bhat)
[1] 0.9408025
> mean(lb<=1 & ub>=1)
[1] 0.904
$\endgroup$
5
  • $\begingroup$ Sorry I don't see the issue? In each iteration I set the seed to be 20110312+i, where i is changing in each iteration, so is the seed? Besides, I also test ran my codes without setting the seeds and got similar results. $\endgroup$
    – Weiyu Qiu
    Mar 17, 2021 at 21:44
  • $\begingroup$ Sorry, I misread the "I" in the code for a "1". $\endgroup$
    – EdM
    Mar 17, 2021 at 21:51
  • $\begingroup$ Do you have the same problem if you set fixed.hazard = TRUE in the function call, instead of the default FALSE? I notice in the vignette that the values of beta specified in a simulation don't agree with the Cox coefficients in a model fitted to the simulated data. I wonder whether that has to do with the randomness in baseline hazards among simulated cases with the default fixed.hazard = FALSE. $\endgroup$
    – EdM
    Mar 18, 2021 at 21:41
  • $\begingroup$ Thank you EdM. I haven't tried fixed.hazard = TRUE yet, but I just read this link: discourse.datamethods.org/t/when-is-censoring-too-high/1534, in which it wrote something about too high censoring rate may lead to biased analytical results. I think it may cause my problem, as I set up censoring = 0.85 which is way too high. (?) I tried a low censoring rate (censor = 0.1) and did the simulation again, and so far it looked more right to me. $\endgroup$
    – Weiyu Qiu
    Mar 19, 2021 at 2:43
  • $\begingroup$ If you found that the high censoring was the source of the problem, or if fixed.hazard =TRUE helps, please post that work as an answer to this question. It's OK to post answers to your own questions here. That would be a service to others who come to this site with a similar question. $\endgroup$
    – EdM
    Mar 19, 2021 at 15:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.