I am trying to use the R survival package to create a log(-log(survival)) graph for a log (time)
(This is sometimes recommended as a visual inspection method for accelerated vital or proportional hazard properties.) Sub>
" fun=cloglog " in plot.survfit does not create what I expect.
Using the "gehan" data from the "MASS" library:
firstly, here is a simple survival vs. time schedule for treatment and control groups:
> data(gehan) > gehansurv=Surv(gehan$time, gehan$cens) > plot(survfit(gehansurv ~ gehan$treat), col=c("black", "red"))

OK so far. Now, if I use the fun=cloglog , the documentation for plot.survfit makes me think that I will get a graph of log(-log(survival)) versus log(time) :
fun
- an arbitrary function that determines the transformation of the survival curve. For example, fun = log is an alternative way to build a survival curve (but with an axis labeled log (S) value), and fun = sqrt generates a curve on a square scale. Four commonly used transformations can be specified using a character argument: "log" is the same as using the parameter log = T, "event" displays cumulative events (f (y) = 1-y), "cumhaz" displays the cumulative hazard function (f (y) = -log (y)), and “cloglog” creates a free log-log (f (y) = log (-log (y)) along with the logarithmic scale for the x axis).
However, when I try to do this, it does not use the log(-log(y)) function because the displayed curve is still decreasing (since the original survival curve is decreasing and the applied function f(y)=log(-log(y)) is a decreasing function, the resulting log(-log(survival)) curve log(-log(survival)) should increase).
In addition, the x axis does not scale on a scale:
> plot(survfit(gehansurv ~ gehan$treat), col=c("black", "red"), fun=cloglog)

I can get what I want by defining my own function log(-log()) and using the parameter log="x" :
> myfun=function(p){return(log(-log(p)))} > plot(survfit(gehansurv ~ gehan$treat), col=c("black", "red"), fun=myfun, log="x")

So: what am I doing wrong above (or how am I misinterpreting the documentation for plot.survfit )?
Additional question: how would the "fun=" option change the scale on the horizontal axis, since the documentation says that "fun=cloglog" will happen if the argument "fun" on its face is a function applied to the vertical variable