Frage

Is it possible to substract one survdiff object from another one in R, using the survival package?

I want to plot a figure that shows in which intervals one survival curve is higher/lower than the other and by how much.

War es hilfreich?

Lösung

one possible solution with survA and survB as survdiff-objects:

interval <- 0:2500
# choose a different time interval if you want

sumA <- summary(survA, time = interval)
sumB <- summary(survB, time = interval)

both <- data.frame(time = interval, A = sumA$surv, B = sumB$surv)

both$diff <- both$B - both$A
# or both$diff <- both$A - both$B

plot(x = both$time, y = both$diff, type = "line")
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top