0

I've been able to plot a survival curve for my data using the following R code:

radiation=read.csv("radiation.csv",header=T)
head(radiation)
attach(radiation)
summary(Treatment)
library(splines)
library(survival)
log_rank=survdiff(Surv(radiation$Time)~radiation$Treatment)
log_rank
sfit<-survfit(Surv(radiation$Time)~radiation$Treatment)
plot(sfit,lty=c("solid","dashed"),col=c("red","green"),xlab="survival time in hours",ylab="survival probability")
title("Survival post lethal dose radiation")
legend("topright",c("GF","Placebo"),lty=c("solid","dashed"),col=c("red","green"))

What I'm stuck on now is how to find the x-value (time), when survival probability (y) is 50%.

Is there an R code for this?

Thanks!

MrFlick
  • 195,160
  • 17
  • 277
  • 295
Úna
  • 1
  • 1
  • It's easier to help you if you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data. Perhaps use a built-in data set rather than "radiation.csv" which we don't have. – MrFlick Dec 04 '17 at 15:36
  • Related: https://stats.stackexchange.com/questions/26247/estimating-a-survival-probability-in-r – MrFlick Dec 04 '17 at 15:37
  • That would be the median survival time and should be available with standard functions in the `survival` package. Have your tried searching? This is what seemed like a possible answer: https://stackoverflow.com/questions/20724872/median-from-survfit-object-and-textconnection/20725165#20725165 – IRTFM Dec 05 '17 at 02:53

0 Answers0