2
$\begingroup$

The survival function for the Weibull distribution is:

$S(t) = exp(-\lambda t^\alpha)$, $\lambda$ = scale parameter, $\alpha$ = shape parameter

If I wanted to calculate the median survival time, I would set $S(t) = 0.5$. Rearranging terms, this means the median survival time would be calculated as follows:

$t_{median} = (\frac{-log(0.5)}{\lambda})^{(1/\alpha)}$

Let's say I set $\lambda = 3$ and $\alpha = 2$. Then the median survival time is clearly:

$t_{median} = (\frac{-log(0.5)}{3})^{(1/2)} = 0.481$

However, when I do a sanity check on this and run this in R, the median survival for a Weibull distribution with scale = 3 and shape = 2 is clearly not 0.481 and is more like 2.5:

Time <- sort(rweibull(1000, shape = 2, scale = 3))
Time[500]

Any time I run this code, I am getting somewhere right around 2.5, +/- 0.1 or so. But definitely nowhere near 0.481.

So what do I have wrong here? Why is the actual median time for simulated data nowhere near the theoretical median time?

$\endgroup$
2
  • 5
    $\begingroup$ I get a different survival function: $S(t) = \exp(-(t/\lambda)^\alpha)$ and hence the median survival time is $\lambda\log(2)^{(1/\alpha)}$. With $\lambda = 3, \alpha = 2$ this evaluates to $2.49766$ as you found using simulation. This is what the Wikipedia article lists under "Median". $\endgroup$ Commented Apr 17, 2023 at 20:16
  • 1
    $\begingroup$ As always with these things, when you get a discrepancy, check the parameterization being used is identical. $\endgroup$
    – Glen_b
    Commented Apr 18, 2023 at 6:03

1 Answer 1

5
$\begingroup$

You got trapped in the thicket of multiple parameterizations of the Weibull distribution.

In what Wikipedia calls the "standard parameterization", the survival function with scale parameter $\lambda$ and shape parameter $\alpha$ is:

$$S(t)=\exp(-(t/\lambda)^\alpha). $$

That's the parameterization used by rweibull(). In that parameterization, the median is $\lambda(\ln 2)^{(1/\alpha)}$, which for $\lambda= 3$ and $\alpha = 2$ gives:

3*(log(2)^(1/2))
# [1] 2.497664

presumably close to the value that you found by simulation.

You seem to be using what Wikipedia calls the "first alternative parameterization."

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.