r - How do I plot the 'inverse' of a survival function? -
i trying plot inverse of survival function, data i'm increase in proportion of event on time. can produce kaplan-meier survival plots, want produce 'opposite' of these. can kind of want using following fun="cloglog":
plot(survfit(surv(days_until_workers,workers)~queen_number+treatment,data=xdata), fun="cloglog", lty=c(1:4), lwd=2, ylab="colonies workers", xlab="days", las=1, font.lab=2, bty="n") 
but don't understand quite has done time (i.e. doesn't start @ 0 , distance decreases?), , why survival lines extend above y axis.
would appreciate this!
cheers
use fun="event" desired output
fit <- survfit(surv(time, status) ~ x, data = aml) par(mfrow=1:2, las=1) plot(fit, col=2:3) plot(fit, col=2:3, fun="event") 
the reason fun="cloglog" screwing axes not plot fraction @ all. instead plotting according ?plot.survfit:
"cloglog" creates complimentary log-log survival plot (f(y) = log(-log(y)) along log scale x-axis)
moreover, fun argument not limited predefined functions "event" or "cloglog", can give own custom function.
plot(fit, col=2:3, fun=function(y) 3*sqrt(1-y))
Comments
Post a Comment