[R] survreg function in survival package
carol white
wht_crl at yahoo.com
Mon Nov 16 14:08:20 CET 2009
Thank you David.
I don't think that I could pass by rweibull function since I use uniform random variable to generate survival times having weibull distribution. Therefore, like you, I have not found any other solution to set the shape parameter. If I want to calculate hazard, I will need both scale and shape parameters.
Sorry, just forgot to reply to all when replying to your email. Unfortunately, nobody else has replied yet so I wonder if anybody else could be helpful.
Cheers,
--- On Sat, 11/14/09, David Winsemius <dwinsemius at comcast.net> wrote:
> From: David Winsemius <dwinsemius at comcast.net>
> Subject: Re: [R] survreg function in survival package
> To: "carol white" <wht_crl at yahoo.com>
> Date: Saturday, November 14, 2009, 8:44 AM
> It appears from a look at the str()
> output from your survreg object that you did set the scale
> parameter, at least the $scale value is set to 1 which is
> not what happens when that procedure is employed without
> that explicit setting. Does that mean that the coefficients
> were the shape parameters? The help page for
> survreg.distributions {survival} says that the scale =
> 1/shape and that the intercept is =log(scale).
>
> ?survreg.distributions
> ?survreg.object
>
> And this is found in the survreg example:
> # There are multiple ways to parameterize a Weibull
> distribution. The survreg
> # function imbeds it in a general location-scale familiy,
> which is a
> # different parameterization than the rweibull function,
> and often leads
> # to confusion.
> # survreg's scale = 1/(rweibull shape)
> # survreg's intercept = log(rweibull scale)
> # For the log-likelihood all parameterizations lead to the
> same value. y <- rweibull(1000, shape=2, scale=5)
> survreg(Surv(y)~1, dist="weibull")
> I find that a bit confusing because it would seem that the
> scale should not be a (pseudo-)random number. I was
> especting to read that scale would be either pweibull(shape)
> or qweibull(shape). Guess I will need to go back to my
> textbooks when I have time, which sadly I do not have
> today.
> Given that you are asking this offlist, I am sending it
> only to you which is not the optimal method for this
> exchange. It means that neither one of us wiil get our
> confusion and questions addressed by more knowledgeable
> persons reading the r-help list. My suggestion is that you
> copy this to the list.
> --David
> On Nov 13, 2009, at 9:02 AM, carol white wrote:
>
> > Thanks for your reply.
> >
> > which parameter presents the base line scale
> parameter? How is it possible to set the shape parameter for
> weibull in survreg?
> >
> > Many thanks
> >
> > --- On Fri, 11/13/09, David Winsemius <dwinsemius at comcast.net>
> wrote:
> >
> >> From: David Winsemius <dwinsemius at comcast.net>
> >> Subject: Re: [R] survreg function in survival
> package
> >> To: "carol white" <wht_crl at yahoo.com>
> >> Cc: r-help at stat.math.ethz.ch
> >> Date: Friday, November 13, 2009, 3:56 AM
> >>
> >> On Nov 13, 2009, at 3:17 AM, carol white wrote:
> >>
> >>> Hi,
> >>> Is it normal to get intercept in the list of
> >> covariates in the output of survreg function with
> standard
> >> error, z, p.value etc? Does it mean that intercept
> was
> >> fitted with the covariates? Does Value column
> represent
> >> coefficients or some thing else?
> >>>
> >>
> >> Don't you need a baseline scale parameter for the
> Weibull
> >> function? You didn't offer the structure of your
> dataframe,
> >> but if it is the "standard" ovarian set, then the
> rx coef is
> >> just the difference between the scale parameter of
> rx=2 from
> >> that of rx=1, and similarly for ecog.ps. You would
> not have
> >> an estimate for rx=1 and ecog.ps=1 if you were not
> given the
> >> Intercept coef.
> >>
> >> In the future it would be good manners to indicate
> what
> >> grad school you are taking classes at.
> >>
> >>
> >> --David
> >>
> >>> Regards,
> >>>
> >>>
> -------------------------------------------------
> >>> tmp = survreg(Surv(futime, fustat) ~ ecog.ps +
> rx,
> >> ovarian, dist='weibull',scale=1)
> >>>> summary(tmp)
> >>>
> >>> Call:
> >>> survreg(formula = Surv(futime, fustat) ~
> ecog.ps + rx,
> >> data = ovarian,
> >>> dist = "weibull",
> scale = 1)
> >>>
> >> Value Std. Error
> >> z p
> >>> (Intercept) 6.962
> >> 1.322 5.267 1.39e-07
> >>> ecog.ps -0.433
> >> 0.587 -0.738 4.61e-01
> >>> rx
> >> 0.582 0.587
> >> 0.991 3.22e-01
> >>>
> >>> Scale fixed at 1
> >>>
> >>> Weibull distribution
> >>> Loglik(model)=
> -97.2 Loglik(intercept
> >> only)= -98
> >>> Chisq= 1.67 on 2
> degrees of
> >> freedom, p= 0.43
> >>> Number of Newton-Raphson Iterations: 4
> >>> n= 26
> --
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
>
More information about the R-help
mailing list