# Weibull Survival Model in R

If I run a Weibull survival model in R with the code

survreg(Surv(t,delta)~expalatory variables, dist="w")


how do I interpret the output of the model? That is, is the form of the model just $1-\exp(e/\lambda)^k)$ with $\lambda$ the scale and $k$ the shape or does it take a different form?

I have found something which says that the output is of the form $$\exp(-\exp(-\alpha_0-\alpha_1-\ldots)^kx^k),$$ where the $\alpha_i$ are the coefficients of the covariates. If so, the output would give me the following parameters:

$$k=k \quad \mbox{and} \quad \lambda=\frac{1}{\exp(-\alpha_0-\alpha_1\ldots)}.$$

• Slight algebra turns you "output of the form..." to a*exp(-x^k). I don't think that is correct. That looks like a cousin of the Arrhenius equation. – EngrStudent - Reinstate Monica Jun 28 '15 at 19:32
• @EngrStudent Sorry i don't understand what you are saying here? – hmmmm Jun 28 '15 at 20:03
• Here is the general form of Weibull. itl.nist.gov/div898/handbook/eda/section3/eda3668.htm – EngrStudent - Reinstate Monica Jun 28 '15 at 21:32
• @EngrStudent Thanks, I am aware of the form of the Weibull Distribution. The problem I have is that if I run survreg with the Weibull distribution in R then it gives the shape and scale parameter, however I these have been transformed in some way (to make it fit in more general distribution family) and I need to know what the transformation is so that I can get the actual shape and scale parameters. – hmmmm Jun 29 '15 at 9:31

Ok so I'm just going to post an answer here using the R help that DWin described. Using the function rweibull in R gives the usual form of the Weibull distribution, with its cumulative function being:

$$F(x)=1-\exp(-\left ( \frac{x}{b}\right )^a)$$

So we will denote the shape parameter of rweibull by $a$ and the scale parameter of rweibull by $b$.

Now the problem is that the output of survreg gives both shape and scale parameters which are not the same as the shape and scale parameters from rweibull. Let us denote the shape parameter from survreg as $a_s$ and the scale parameter of survreg by $b_s$.

Then, from ?survreg we have that:

survreg's scale = 1/(rweibull shape)

survreg's intercept = log(rweibull scale)

So this gives us that:

$$a=\frac{1}{b_s}\quad \mbox{and} \quad b=\exp(a_s)$$

So if we suppose that we run the function survreg with $n$ covariates, then the output will be:

$\alpha_0,\ldots, \alpha_{n-1}$, the coefficents of the covariates and some scale parameter $k$. The Weibull model given in standard form is then given by:

$$F(x)=1-\exp\left (- \left (\frac{x}{\exp(\alpha_0+\alpha_1+\ldots +\alpha_{n-1})} \right ) ^{\frac{1}{k}}\right )$$

The help page for ?Weibull says:

The Weibull distribution with shape parameter a and scale parameter b has density given by

f(x) = (a/b) (x/b)^(a-1) exp(- (x/b)^a)

And then the help page for ?survreg says:

# There are multiple ways to parameterize a Weibull distribution. The survreg
# function embeds it in a general location-scale family, 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)


And there is an elaboration of how this is handled in the Examples section of ?survreg.distributions

• How would you incorporate exploratory variables in the the weibull function? – forecaster Jun 28 '15 at 21:10
• That's much too vague in it's current form. Why not post a question with description of a data layout? – DWin Jun 28 '15 at 21:12
• I was trying to point out that your answer is not helpful in addressing OP question, just providing r help pages is not helpful. – forecaster Jun 28 '15 at 21:33
• Why is adding covariates helpful here? – DWin Jun 28 '15 at 22:54
• The point that I thought was helpful is that the Weibull distribution implementation used in the R survival package is different than what is used in many textbooks (and in R's own rweibull.) – DWin Apr 26 '16 at 23:18