rm(list = ls())
library(HQM)

library(survival)
pbc2.id = to_id(pbc2)

KM_fit <- survfit(Surv(years, status2) ~ drug, data = pbc2.id)

 

plot(KM_fit, xlab = "Years", ylab = "Survival probability of placebo and D-penicil patients", col = 1:2, lwd=2)
legend("bottomleft", c("Placebo", "D-penicil"), lty = c(1,1), col = 1:2, lwd=c(2,2), bty = "n", cex=2)

plot(KM_fit, fun = function (s) -log(-log(s)), xlab = "Years",  ylab = "-log(- log(Survival))", col = 1:2, lwd=2)
legend("bottomleft", c("Placebo", "D-penicil"), lty = c(1,1), col = 1:2, lwd=c(2,2), bty = "n", cex=2)

 