Edit: The code below I think demonstrates the point I refer to in my comments below this question, that is the bias in the estimation of the hazard function is not related to the bias in the estimation of the regression parameters. In my opinion (which may be wrong) the censoring in this code is not informative since the censoring does not depend on the covariates. If anybody can show me how to amend the code to produce informative censoring that produces biased regression estimates that would be great - then perhaps I will understand what informative censoring is.
##install.packages("muhaz")
library(muhaz)
censRand <- function(time, cens.t.5){ # cens.t.5 is the t 1/2 of censor process
ctime <- rexp(n = length(time), rate = 1/cens.t.5)
event <- (time <= ctime)
t_obs <- pmin(time, ctime)
return(data.frame(Times=t_obs, event=event))
}
N=10000
#simulate a hazard of the form;
# h(t|x) = lambda*exp[(beta_age*age)+(beta_treat*treat)]
# Do this by drawing from an exponential distribution
beta_age = 0.5
beta_treat = -1
age = rnorm(N,33,2)
treat = rbinom(N,1,0.5)
lp = (beta_age*age)+(beta_treat*treat)
lambda=0.000001
time=rexp(N, lambda*exp(lp))
##censoring times
ctime <- censRand( time, 0.1)
pc_cen = round((length(ctime[ctime[,2]==FALSE,2])/N)*100,2)
##plots
par(mfrow=c(2,2))
tit = paste("CTTE (censored = ",toString(pc_cen)," %)")
hist(time,breaks=20,main="TTE")
hist(ctime[,1],breaks=20,main=tit)
##fit the Cox model
cox_obj = coxph(Surv(ctime[ ,1],ctime[ ,2],type=c("right"))~age+treat )
summary(cox_obj)
plot( muhaz( ctime[ ,1], ctime[,2]) )