dist_weibull: The Weibull distribution

View source: R/dist_weibull.R

dist_weibullR Documentation

The Weibull distribution

Description

[Stable]

Generalization of the gamma distribution. Often used in survival and time-to-event analyses.

Usage

dist_weibull(shape, scale)

Arguments

shape, scale

shape and scale parameters, the latter defaulting to 1.

Details

We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_weibull.html

In the following, let X be a Weibull random variable with shape parameter shape = k and scale parameter scale = \lambda.

Support: [0, \infty)

Mean:

E(X) = \lambda \Gamma\left(1 + \frac{1}{k}\right)

where \Gamma is the gamma function.

Variance:

\text{Var}(X) = \lambda^2 \left[\Gamma\left(1 + \frac{2}{k}\right) - \left(\Gamma\left(1 + \frac{1}{k}\right)\right)^2\right]

Probability density function (p.d.f):

f(x) = \frac{k}{\lambda}\left(\frac{x}{\lambda}\right)^{k-1}e^{-(x/\lambda)^k}, \quad x \ge 0

Cumulative distribution function (c.d.f):

F(x) = 1 - e^{-(x/\lambda)^k}, \quad x \ge 0

Moment generating function (m.g.f):

E(e^{tX}) = \sum_{n=0}^\infty \frac{t^n\lambda^n}{n!} \Gamma\left(1+\frac{n}{k}\right)

Skewness:

\gamma_1 = \frac{\mu^3 - 3\mu\sigma^2 - \mu^3}{\sigma^3}

where \mu = E(X), \sigma^2 = \text{Var}(X), and the third raw moment is

\mu^3 = \lambda^3 \Gamma\left(1 + \frac{3}{k}\right)

Excess Kurtosis:

\gamma_2 = \frac{\mu^4 - 4\gamma_1\mu\sigma^3 - 6\mu^2\sigma^2 - \mu^4}{\sigma^4} - 3

where the fourth raw moment is

\mu^4 = \lambda^4 \Gamma\left(1 + \frac{4}{k}\right)

See Also

stats::Weibull

Examples

dist <- dist_weibull(shape = c(0.5, 1, 1.5, 5), scale = rep(1, 4))

dist
mean(dist)
variance(dist)
skewness(dist)
kurtosis(dist)

generate(dist, 10)

density(dist, 2)
density(dist, 2, log = TRUE)

cdf(dist, 4)

quantile(dist, 0.7)


distributional documentation built on June 11, 2026, 9:07 a.m.