# NOT RUN {
fr_var <- c(0.001, 0.01, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9)
profloglik <- emfrail_pll(Surv(time, status) ~ rx + sex + cluster(litter), rats,
values = 1/fr_var)
plot(fr_var, profloglik, xlab = "frailty variance", ylab = "profile log-likelihood")
# check with coxph:
profloglik_cph<- sapply(fr_var, function(th)
coxph(data = rats, formula = Surv(time, status) ~ rx + sex + frailty(litter, theta = th),
method = "breslow")$history[[1]][[3]])
lines(fr_var, profloglik_cph, col = 2)
# }
Run the code above in your browser using DataLab