I am trying to replicate some analyses that someone performed in Stata. They used a function (or program as they are called in Stata?) called "stexpect3" to generate a "smoothed hazard plot" like this. Wondering if anyone can point me in the direction of how to do this in R? I have come across a few options such as "bshazard" but they don't seem to give me what I am after.
For example, using the lung dataset, I get a plot like this with "hazard rate" on the y-axis. How would I generate the equivalent of the above plot using this lung dataset as an example?
lung <- lung
fit<-bshazard(Surv(time, status) ~ sex,data=lung)
plot(fit)