Donald Catanzaro
2016-Sep-24 03:58 UTC
[R] Cumulative Incident Function does not go to end of dataset
Hi All, I have been working on a Competing Risks analysis using the mstate package and when I run my analysis I was surprised to see the cumulative incident function ending substantially before my data set did. You can reproduce the behavior (kind of) using the data that was provided with mstate: library(mstate) data(aidssi) ci <- Cuminc(time=aidssi$time, status=aidssi$status) and you can see that ci goes to 10.448 However, when you use the cmprsk package, the CIF goes pretty much to the end of the data library(cmprsk) CI.overall <- cuminc(ftime =aidssi$time, fstatus=aidssi$status) and you can see that CI.overall ends at 12 Using the data provided in the package, a difference of < 2 years is not terrible but with my dataset mstate ends at 1.02 while cmprsk ends at 4 (my max for event time is 4.9) and that is a substantial difference. I believe I must be missing something here. Is there a way to get mstate to report the entire CIF ? -- - Don Donald Catanzaro PhD dgcatanzaro at gmail.com 16144 Sigmond Lane Lowell, AR 72745 479-721-2533 [[alternative HTML version deleted]]
David Winsemius
2016-Sep-24 14:17 UTC
[R] Cumulative Incident Function does not go to end of dataset
> On Sep 23, 2016, at 8:58 PM, Donald Catanzaro <dgcatanzaro at gmail.com> wrote: > > Hi All, > > I have been working on a Competing Risks analysis using the mstate package > and when I run my analysis I was surprised to see the cumulative incident > function ending substantially before my data set did. > > You can reproduce the behavior (kind of) using the data that was provided > with mstate: > > library(mstate) > data(aidssi) > ci <- Cuminc(time=aidssi$time, status=aidssi$status) > > > and you can see that ci goes to 10.448 > > However, when you use the cmprsk package, the CIF goes pretty much to the > end of the data > > > library(cmprsk) > CI.overall <- cuminc(ftime =aidssi$time, fstatus=aidssi$status) > > and you can see that CI.overall ends at 12 > > Using the data provided in the package, a difference of < 2 years is not > terrible but with my dataset mstate ends at 1.02 while cmprsk ends at 4 (my > max for event time is 4.9) and that is a substantial difference. > > I believe I must be missing something here. Is there a way to get mstate to > report the entire CIF ?If you compare the output of plot(ci) and plot(CI.overall) they appear identical, modulo a difference in the range of the plot. The help page for Cuminc says that: "Cuminc is now simply a wrapper around survfit of the survival package with type="mstate", only maintained for backward compatibility. The survfit object is kept as attribute (attr("survfit")), and the print, plot and summary functions are simply print, plot and summary applied to the survfit object." So it would seem that you should be extracting your desired estimates from that attribute.> > -- > - Don > > Donald Catanzaro PhD > dgcatanzaro at gmail.com > 16144 Sigmond Lane > Lowell, AR 72745 > 479-721-2533 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.David Winsemius Alameda, CA, USA
Donald Catanzaro
2016-Sep-25 04:02 UTC
[R] Cumulative Incident Function does not go to end of dataset
Hi All, Thank you David, I see now that what I need to do is something like plot(attr(ci,"survfit"), col=c("red","green")) and I will get the plot with the two CIFs in different colors. On Sat, Sep 24, 2016 at 9:17 AM, David Winsemius <dwinsemius at comcast.net> wrote:> > > On Sep 23, 2016, at 8:58 PM, Donald Catanzaro <dgcatanzaro at gmail.com> > wrote: > > > > Hi All, > > > > I have been working on a Competing Risks analysis using the mstate > package > > and when I run my analysis I was surprised to see the cumulative incident > > function ending substantially before my data set did. > > > > You can reproduce the behavior (kind of) using the data that was provided > > with mstate: > > > > library(mstate) > > data(aidssi) > > ci <- Cuminc(time=aidssi$time, status=aidssi$status) > > > > > > and you can see that ci goes to 10.448 > > > > However, when you use the cmprsk package, the CIF goes pretty much to the > > end of the data > > > > > > library(cmprsk) > > CI.overall <- cuminc(ftime =aidssi$time, fstatus=aidssi$status) > > > > and you can see that CI.overall ends at 12 > > > > Using the data provided in the package, a difference of < 2 years is not > > terrible but with my dataset mstate ends at 1.02 while cmprsk ends at 4 > (my > > max for event time is 4.9) and that is a substantial difference. > > > > I believe I must be missing something here. Is there a way to get > mstate to > > report the entire CIF ? > > > If you compare the output of plot(ci) and plot(CI.overall) they appear > identical, modulo a difference in the range of the plot. > > The help page for Cuminc says that: "Cuminc is now simply a wrapper around > survfit of the survival package with type="mstate", only maintained for > backward compatibility. The survfit object is kept as attribute > (attr("survfit")), and the print, plot and summary functions are simply > print, plot and summary applied to the survfit object." So it would seem > that you should be extracting your desired estimates from that attribute. > > > > > -- > > - Don > > > > Donald Catanzaro PhD > > dgcatanzaro at gmail.com > > 16144 Sigmond Lane > > Lowell, AR 72745 > > 479-721-2533 > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > David Winsemius > Alameda, CA, USA > >-- - Don Donald Catanzaro PhD dgcatanzaro at gmail.com 16144 Sigmond Lane Lowell, AR 72745 479-721-2533 [[alternative HTML version deleted]]