- Perform the following step to generate a diagnostic plot of the fitted model:
> install.packages("survminer") > library(survminer)
- Generate sfit in case the previous recipe is not completed:
> hist(cancer$time, xlab="Survival Time", main="Histogram of survival time")
Histogram of survival times
- We can see from the preceding diagram that as days increase, the survival chances are low. The survival rate is high for 100 to 300 days.
- We want to see how gender plays a role in survival or we want to see the survival by gender. This can be achieved by the Kalpan-Meier Estimator plot. Perform the following step:
> s <- Surv(cancer$time, ...