# Survival – Mean Survival Time of a Weibull Distribution

survivalweibull 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.

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
> #---------------------------------------------