[R] Weibull survival regression

Aleš Žiberna ales.ziberna at guest.arnes.si
Tue Nov 23 11:31:16 CET 2004


I do not belive there is a plot method for survreg object.

#You can plot survuval using the coeficents it returns:
curve(exp(-(exp(-lung.wbs$coef[1])*x)^(1/lung.wbs$scale)))

#Here is an exemple for "lung" data from library "survival"
library(survival)
data(lung)
lung.wbs <- survreg( Surv(time, status)~1, data=lung, dist='weibull')
plot(survfit(Surv(time,status),data=lung))
curve(exp(-(exp(-lung.wbs$coef[1])*x)^(1/lung.wbs$scale)),col="red",add=T)


----- Original Message ----- 
From: "Eric Lim" <eric.lim at cvsnet.org>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, November 23, 2004 7:56 AM
Subject: [R] Weibull survival regression


Dear R users,

Please can you help me with a relatively straightforward problem that I
am struggling with? I am simply trying to plot a baseline survivor and
hazard function for a simple data set of lung cancer survival where
`futime' is follow up time in months and status is 1=dead and 0=alive.

Using the survival package:

lung.wbs <- survreg( Surv(futime, status)~ 1, data=lung, dist='weibull')

plot (lung.wbs)

Returns the error msg:

Error in xy.coords(x, y, xlabel, ylabel, log) :
        x and y lengths differ

Using the Design package:

lung.wbd <- psm (Surv (futime, status)~ 1, dist="weibull", data=lung,
na.action=na.omit)

survplot(lung.wbd)

Returns the error msg:

Error in survplot.Design(lung.wbd) : fit does not have design
information

Using the eha package (I have not figured out how to get baseline
function only, but have used ht=0/1 hypertension as a covariate):

lung.wbe <- weibreg (Surv (futime, status)~ ht, y=T, data=audit,
na.action=na.omit)

plot (lung.wbe)

I get a plot with hazard (y) against age (x) ??? I cannot control the
axes with labeling and any other covariate gets the same plot.

I have tried using covariates in the Design and Survival packages, but
they always return the same error msgs. I realise that the former 2 are
AFT survival models, but even when I convert the object with pphsm() in
the Design package, I get the same errors.

Please can anyone enlighten me as to what I seem to be doing /
understanding wrongly?

Regards,

Eric Lim
Papworth Hospital
Cambridge, UK


           futime status
 [1,]  0.40000000      1
 [2,]  0.80000000      1
 [3,]  7.10000000      1
 [4,]  3.00000000      1
 [5,]  0.63333333      1
 [6,]  9.93333333      1
 [7,]  0.50000000      1
 [8,]  6.93333333      1
 [9,] 23.33333333      1
[10,]  1.73333333      1
[11,] 24.66666667      1
[12,]  0.06666667      1
[13,] 14.43333333      1
[14,]  8.83333333      0
[15,] 27.53333333      0



[[alternative HTML version deleted]]

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list