# Mean survival time of a Weibull distribution

I'm trying to calculate the mean survival time of a Weibull distribution, and am getting what feels like an errant estimate of the mean--and each source I look up for how to calculate the mean gives a slightly different formulation.

Going from Klein and Moeschberger, the mean is:

$$\frac{\Gamma(1+1/\alpha)}{\lambda^{1/\alpha}}$$

As I understand it, $\alpha$ is the shape parameter, and $\lambda$ is $\exp(\beta_0...\beta_ k)$ for a model with $k$ terms. Is this correct?

Thus, for a model with two $\beta$ terms, $\beta_0 = 2.18$ and $\beta_1 = 0.66$ along with an $\alpha$ of 0.88, is the mean survival time, as evaluated by R for a non-integer Gamma function as follows:

b0 <- 2.18
b1 <- 0.66
alpha <- 0.88

mean <- (gamma(1+(1/alpha)))/(exp(2.18+0.66)**(1/alpha))


Correct? That produces a mean of 0.0423, which seems...small, even for such a skewed distribution.

• I'll try to write up a proper answer in a bit, but one must be very careful and explicit about the parametrization. In fact, $R$ uses at least two which adds to the confusion: One for the pgamma etc. class of functions and a different one for survreg etc. A good sanity check is to reduce to the exponential case by appropriate setting of the parameters and see if the answer you get is consistent. Jan 4, 2013 at 11:23
• Further double-checking against the Rayleigh case may also help. Jan 4, 2013 at 11:24
• Checking against a Exponential E(x) of 1/lambda = 1/(exp(2.18+0.66)) yields a similar estimate of 0.058. Jan 4, 2013 at 11:28

According to the mean you give, you use the following parametrisation for the Weibull distribution: $$\textrm{if }X\sim \textrm{Weibull}(\lambda, \alpha) \textrm{ then } f_X(x) = \lambda \alpha x^{\alpha - 1} \exp(-\lambda x^\alpha),$$ with $\lambda > 0$ a scale parameter, and $\alpha > 0$ a shape parameter.

dweibull() from R, as well as wikipedia, use another parametrisation. The conversion is as follows: $$\textrm{shape} = \alpha \quad \textrm{and} \quad \textrm{scale} = \left(\frac{1}{\lambda} \right)^{\tfrac{1}{\alpha}},$$ where $\textrm{shape}$ and $\textrm{scale}$ are those given in dweibull() and wikipeida.

Let $\mathbf{x}'\mathbf{\beta} = x_1\beta_1 + x_2\beta_2 + \dotsb$ be the linear predictor.

Assuming a proportional hazards structure and a $\textrm{Weibull}(\lambda, \alpha)$ distribution at baseline, the hazard rate is written \begin{align*} h(t) & = h_0(t) \exp(\mathbf{x}'\mathbf{\beta}) \\ & = \lambda \alpha t^{\alpha - 1} \exp(\mathbf{x}'\mathbf{\beta}). \end{align*} The corresponding pdf is $$f(t) = \lambda \alpha t^{\alpha - 1} \exp(\mathbf{x}'\mathbf{\beta}) \exp \left( - \lambda t^\alpha \exp(\mathbf{x}'\mathbf{\beta}) \right).$$ That is, $T$ has a Weibull distribution with the same shape $\alpha$ but the scale parameter is changed from $\lambda$ to $\lambda \exp(\mathbf{x}'\mathbf{\beta})$: $$T \sim \textrm{Weibull}(\lambda \exp(\mathbf{x}'\mathbf{\beta}), \alpha)$$ and we have $$E[T] = \frac{\Gamma(1 + \tfrac{1}{\alpha})}{\left(\lambda\exp(\mathbf{x}'\mathbf{\beta})\right)^{\tfrac{1}{\alpha}}}.$$

An example without covariate:

> #------ scale and shape parameters in your parametrisation ------
> lambda <- 3
> alpha <- 0.88
> #----------------------------------------------------------------
>
> #------ conversion ------
> shape <- alpha
> scale <- (1 / lambda)^(1 / alpha)
> #------------------------
>
> #------ some data ------
> T <- rweibull(n=10000, shape=shape, scale=scale)
> #-----------------------
>
> #------ theoretical and empirical means ------
> gamma(1 + 1 / alpha) / (lambda^(1 / alpha))
[1] 0.305765
> mean(T)
[1] 0.3026293
> #---------------------------------------------


• Notation has always been somewhere I'm shaky. (x'beta) is the vector of beta coefficients, yes? If so, then what's lambda? Jan 4, 2013 at 12:03
• I have edited to make it clear Jan 4, 2013 at 12:09
• I think I follow now, thank you again for the edits. In your example, lambda = 1, and the models I'm basing off this in SAS report only a single parameter in addition to the beta coefficients. That seems to suggest they too are assuming lambda = 1, and it also appears to be the default in R. Is there a reason for this? Also given your example, it appears my calculation of the mean above is correct? I confess to being a little shell-shocked by the difference between the mean and median for a Weibull with those parameters. Jan 4, 2013 at 12:36
• I have changed the example because there is no particular reason for lambda = 1. Regarding your calculation, I think you missed $\lambda$ in the scale parameter which should be $\lambda \exp(\mathbf{x}'\mathbf{\beta})$. That is, $\lambda$ from the baseline distribution (no covariate) is changed to $\lambda \exp(\mathbf{x}'\mathbf{\beta})$ when covariates are added. Jan 4, 2013 at 12:43
• Hrm. I think I see what you're saying - in the calculation I have above, I'm missing λ and only have exp(x′β)? I suppose the question is then if I only have what appear to be estimates of β0, β1 and a single other parameter that I believe is alpha, is it possible to calculate λ? Jan 4, 2013 at 12:55