Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
152 views
in Technique[技术] by (71.8m points)

r - Different Kaplan-Meier Results with Interval2

I've noticed a slight difference between survfit when I use a survival object of type "interval2". I first noticed that the number at risk on the interval2 fit was not an integer. I've stepped through survfit.formula and surviftKM but I'm still not clear as to exactly what's happening and why. Would anyone explain the difference to me? When debugging it appears survfitKM is using some .05 weights (casewt variable), but I'm not setting that explicitly.

MRE:

library('survival')
surv_obj <- with(lung, Surv(time = time, event = status == 1))

left <- lung$time
right <- ifelse(lung$status == 1, lung$time, NA) 
surv_obj_int <- Surv(time = left, time2 = right, type = 'interval2')

surv_fit <- survfit(surv_obj~1, type = 'kaplan-meier')
surv_fit_int <- survfit(surv_obj_int~1, type = 'kaplan-meier')

question from:https://stackoverflow.com/questions/65847332/different-kaplan-meier-results-with-interval2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The repo owner was kind enough to explain.

When there is interval censored data the code uses the Turnbull estimate (survfitTurnbull). In this case the number at risk is not well defined and the code uses a "working" value. In your particular example there are no interval censored observations, and it if twas smarter the code would notice that and use survfitKM: more accurate and a lot faster. But users don't tend to use interval2 style unless they need it.

Although, I'm treating lung as interval censored, there are no actual intervals. If there is a right value, it always equals the left.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...