I am a Stata user now teaching myself R. I have been trying to recapitulate analyses done in Stata using R but have got stuck. A multi-variable Cox regression with an offset in Stata and R give identical results The data can be downloaded from
stset fu, failure(br) stcox ag1 ag2 sz nd grade screen , offset(hc1) nohr
R-code library(survival) fit <- Surv(er1$fu, er1$br) mva <- coxph(fit ~ ag1 + ag2 + sz + nd + grade + screen + offset(hc1), data = er1)
However when I then derive the cumulative baseline hazard functions they are different. This does not occur if I remove the offset term.
predict h0, basechazard twoway scatter h0 _t
h0 <- basehaz(mva, centered = F) ggplot(data=h00, aes(x=time, y=hazard)) + geom_point()