0

I'm plotting CIF survival curves using cmprsk:

cc<-cuminc(fu_m, event, diabetes, rho=0, cencode=0,
    na.action=na.omit)
plot(cc,lty=1:6,color=1, xlab="Months", ylab="Cumulative Incidence")

In this way I obtain 4 curves: event in presence/absence of diabetes and competing event in presence/absence of diabetes.

Here is the plot: enter image description here

I would like to have just two curves:event in presence/absence of diabetes without the competing events' curves.

> str(event)
Factor w/ 3 levels "0","1","2": 1 3 2 1 2 1 1 2 1 1 ...
> str(diabetes)
Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...

Event 0: censured observations, 1: event, 2: competing event

Diabetes 0: no diabetes, 1: presence of diabetes

How can I fix it? Thank you all

Community
  • 1
  • 1
ArTu
  • 431
  • 4
  • 20
  • you can subset the `cuminc` object with `[` like this `plot(cc[1:2])`. This should only plot the event curves but you should play with it a bit – Mike May 17 '18 at 17:53
  • Oh Mike this works just fine!!! Thank you so much!! – ArTu May 18 '18 at 13:50
  • Can I ask you something about Schoenfeld residuals' plots? Thank you again! – ArTu May 18 '18 at 13:51
  • Sure, are you planning to post another question or edit this one? – Mike May 18 '18 at 15:46
  • What could be better? I don't know.. – ArTu May 18 '18 at 16:34
  • uh... something about the plot above..I would like to add le legend, I've tried this way: `plot(gg,lty=c(1,2,3,4),color=1, xlab="Months", ylab="Cumulative Incidence") legend("topright", c("RT, w/o diabetes","RT, w diabetes","D, w/o diabetes", "D, w diabetes"),lty = c(1,2,3,4))` but I obtain two Legends:one with text and lines and one with 01-11-02-12 and lines.. I would like to take just the one with text..Do you know how to fix it? Thank you again so much!!! – ArTu May 18 '18 at 17:00
  • if your question about Schoenfeld is totally different from this post I would create another question, if it is stat related it might belong on the site cross validated. – Mike May 18 '18 at 17:15
  • for your legend there is two ways to fix it first you can us the `wh` parameter inside plot. This will set the text outside of the viewing pane and it will not appear like this `plot(xx[1:2],lty=c(1,2,3,4),color=1, xlab="Months", ylab="Cumulative Incidence",wh=c(0,3)) `. then add your legend. Or use `curvelab` in the plot statement: `plot(xx[1:2],lty=c(1,2,3,4),color=1, xlab="Months", ylab="Cumulative Incidence", curvlab = c("RT, w/o diabetes","RT, w diabetes","D, w/o diabetes", "D, w diabetes")) ` – Mike May 18 '18 at 17:18
  • here's my other question... [link] (https://stackoverflow.com/questions/50416476/how-to-test-ph-assumption-with-schoenfeld-residuals-with-simulated-paths-in-pres) – ArTu May 18 '18 at 17:26
  • OHHH it works!!! You're great!!!! Thank you so so much!!! – ArTu May 18 '18 at 17:29

0 Answers0