Here is a modification of some simplistic code that I had sent Bob
offlist for the gastric data specifically.
I created a function and made it a bit more generic, for multiple
'strata', though there is no real error checking, etc. which would be
needed to make it more robust for production along with more
flexibility
in the esthetics.
It would appear that the y axis in the referenced plot in T&G is
-log(-log(Surv)) based upon the y axis label and playing around
with things.
llplot <- function(x,
main = NULL,
ylab = "-Log(-Log(Survival))", xlab = "Time")
{
strata <- cbind(1:sum(x$strata), rep(1:length(x$strata), x$strata))
ind <- split(strata[, 1], strata[, 2])
finite.y <- is.finite(-log(-log(x$surv)))
ylim <- range(-log(-log(x$surv))[finite.y])
xlim <- c(0, max(x$time))
plot(xlim, ylim, type = "n", main = main,
ylab = ylab, xlab = xlab)
for (i in seq(along = ind))
{
lines(x$time[ind[[i]]],
-log(-log(x$surv[ind[[i]]])),
lty = i, type = "s")
}
}
Thus:
library(survival)
library(surv2sample)
data(gastric)
fit <- survfit(Surv(time, event) ~ treatment, data = gastric)
# This seems to be roughly the right hand plot on page 128 of T&G
# albeit the gastric data in surv2sample seems to have longer
follow up
# now
llplot(fit)
Other examples would be:
fit2 <- survfit(Surv(time, status) ~ x, data = aml)
llplot(fit2)
fit3 <- survfit(Surv(time, status) ~ celltype, data = veteran)
llplot(fit3)
HTH,
Marc Schwartz
on 02/28/2009 10:09 PM David Winsemius wrote:
I think what you want may be produced by this code for
InvNormal(S) vs
log(time):
survplot(fit, fun=qnorm, logT=T, conf = "none")
That is not what you describe, however.
I am worried about the plot on the page you cite, because it is not
similar to other log(-log(S)) (complementary log-log) plots I am
familiar with. I checked the errata listing and do not see a
correction,
but I am still concerned it might not be not a log(-log(S)) vs
time plot.
Terry Therneau has always been very helpful to readers of this
group and
I suspect he can clarify any confusion I may be laboring under.
On Feb 28, 2009, at 5:48 PM, Bob Green wrote:
I am hoping for some advice regarding how to obtain a log-log
survival plot that is not in the inverse. On page 128 of
Modelling survival data by Therneau & Grambsch there is the an
example of the type of desired plot, with a log of the survival
curve by years. Marc Schwartz has provided me with some
reproducible code.
The code below produces inverted plots.
library(surv2sample)
data(gastric)
fit <- survfit ( Surv(time, event) ~ treatment, data = gastric)
#Default plot:
plot(fit)
plot(fit, fun = "cloglog")
library(Design)
survplot(fit, loglog = TRUE, conf = "none")
Any assistance is much appreciated,
regards
Bob