rm
2013-Mar-25 09:47 UTC
[R] Weighted Kaplan-Meier estimates with R (with confidence intervals)?
As part of a research paper, I would like to draw both weighted and unweighted Kaplan-Meier estimates, the weight being the ?importance? of the each project to the mass of projects whose survival I?m trying to estimate. I know that the function survfit in the package survival accepts weights and produces confidence intervals. However, I suspect that the confidence intervals may not be correct. The reason why I suspect this is that depending on how I define the weights, I get very different confidence intervals, e.g. require(survival) s <- Surv(c(50,100),c(1,1)) sf <- survfit(s~1,weights=c(1,2)) plot(sf) vs. require(survival) s <- Surv(c(50,100),c(1,1)) sf <- survfit(s~1,weights=c(100,200)) plot(sf) Any suggestions would be more than welcome! -- View this message in context: http://r.789695.n4.nabble.com/Weighted-Kaplan-Meier-estimates-with-R-with-confidence-intervals-tp4662360.html Sent from the R help mailing list archive at Nabble.com.
Blaser Nello
2013-Mar-25 12:43 UTC
[R] Weighted Kaplan-Meier estimates with R (with confidenceintervals)?
The two confidence intervals should be different. In the first model you have 3 failures and the second one you have 300. More failures results in narrower confidence intervals. -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of rm Sent: Montag, 25. M?rz 2013 10:47 To: r-help at r-project.org Subject: [R] Weighted Kaplan-Meier estimates with R (with confidenceintervals)? As part of a research paper, I would like to draw both weighted and unweighted Kaplan-Meier estimates, the weight being the ?importance? of the each project to the mass of projects whose survival I?m trying to estimate. I know that the function survfit in the package survival accepts weights and produces confidence intervals. However, I suspect that the confidence intervals may not be correct. The reason why I suspect this is that depending on how I define the weights, I get very different confidence intervals, e.g. require(survival) s <- Surv(c(50,100),c(1,1)) sf <- survfit(s~1,weights=c(1,2)) plot(sf) vs. require(survival) s <- Surv(c(50,100),c(1,1)) sf <- survfit(s~1,weights=c(100,200)) plot(sf) Any suggestions would be more than welcome! -- View this message in context: http://r.789695.n4.nabble.com/Weighted-Kaplan-Meier-estimates-with-R-with-confidence-intervals-tp4662360.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
rm
2013-Mar-25 12:55 UTC
[R] Weighted Kaplan-Meier estimates with R (with confidenceintervals)?
Say, that I have two observations, one from time 0 to time 50, and a second from time 0 to time 100, both of which are known to have failed, i.e. no censoring. I would like to give double the weight to the second observation. This is what I?ve tried to implement in the both pieces of code. Both pieces of code give the same survival curve but different confidence intervals. Why? How should I fix the code to get the ?correct? confidence intervals? -- View this message in context: http://r.789695.n4.nabble.com/Weighted-Kaplan-Meier-estimates-with-R-with-confidence-intervals-tp4662360p4662384.html Sent from the R help mailing list archive at Nabble.com.
Milan Bouchet-Valat
2013-Mar-25 15:12 UTC
[R] Weighted Kaplan-Meier estimates with R (with confidenceintervals)?
Le lundi 25 mars 2013 ? 05:55 -0700, rm a ?crit :> Say, that I have two observations, one from time 0 to time 50, and a second > from time 0 to time 100, both of which are known to have failed, i.e. no > censoring. I would like to give double the weight to the second observation. > > This is what I?ve tried to implement in the both pieces of code. Both pieces > of code give the same survival curve but different confidence intervals. > Why? How should I fix the code to get the ?correct? confidence intervals?If the weights you cant to use are sampling weights (as I suspect), use the function survfitkm() from the survey package. Regards> > > > -- > View this message in context: http://r.789695.n4.nabble.com/Weighted-Kaplan-Meier-estimates-with-R-with-confidence-intervals-tp4662360p4662384.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.