library('knitr') read_chunk('../q4.R') opts_chunk$set(cache=FALSE)
We load the dependencies:
Then load the data and define an indicator:
Then we show the results using the actuarial estimator with years:
Similarly, we use the actuarial estimator using months:
Then the code using the Kaplan-Meier estimator with years:
And the Kaplan-Meier estimator with data in months:
The actuarial method is most appropriate because it deals with ties (events and censorings at the same time) in a more appropriate manner. The fact that there are a reasonably large number of ties in these data means that there is a difference between the estimates.
The K-M estimate changes more. Because the actuarial method deals with ties in an appropriate manner it is not biased when data are heavily tied so is not heavily affected when we reduce the number of ties.
The plot clearly shows that the Kaplan-Meier estimator with the aggregated data is upwardly biased compared with the other curves.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.