dist_weibull(shape, scale)
shape and scale parameters, the latter defaulting to 1.
We recommend reading this documentation on https://pkg.mitchelloharawild.com/distributional/, where the math will render nicely.
In the following, let \(X\) be a Weibull random variable with
success probability p
= \(p\).
Support: \(R^+\) and zero.
Mean: \(\lambda \Gamma(1+1/k)\), where \(\Gamma\) is the gamma function.
Variance: \(\lambda [ \Gamma (1 + \frac{2}{k} ) - (\Gamma(1+ \frac{1}{k}))^2 ]\)
Probability density function (p.d.f):
$$ f(x) = \frac{k}{\lambda}(\frac{x}{\lambda})^{k-1}e^{-(x/\lambda)^k}, x \ge 0 $$
Cumulative distribution function (c.d.f):
$$F(x) = 1 - e^{-(x/\lambda)^k}, x \ge 0$$
Moment generating function (m.g.f):
$$\sum_{n=0}^\infty \frac{t^n\lambda^n}{n!} \Gamma(1+n/k), k \ge 1$$
dist <- dist_weibull(shape = c(0.5, 1, 1.5, 5), scale = rep(1, 4))
dist
#> <distribution[4]>
#> [1] Weibull(0.5, 1) Weibull(1, 1) Weibull(1.5, 1) Weibull(5, 1)
mean(dist)
#> [1] 2.0000000 1.0000000 0.9027453 0.9181687
variance(dist)
#> [1] 20.00000000 1.00000000 0.37569028 0.04422998
skewness(dist)
#> [1] 5.0737409 0.0000000 -0.7764597 -38.1055455
kurtosis(dist)
#> [1] 87.48382 14.00000 12.28013 660.88795
generate(dist, 10)
#> [[1]]
#> [1] 0.0009285618 0.2244960531 0.6370253248 1.5431036027 2.2397067295
#> [6] 4.0714176413 1.4079236542 0.0830266694 0.6815069833 0.4816094205
#>
#> [[2]]
#> [1] 0.5928708 2.0781117 1.8017649 0.1832808 2.2492679 0.4191955 0.7308050
#> [8] 1.1865081 0.1366082 1.7174329
#>
#> [[3]]
#> [1] 0.2278173 0.5714259 1.1494807 0.2989658 0.4324150 0.7069031 1.4443770
#> [8] 0.3496481 1.4815720 1.2417617
#>
#> [[4]]
#> [1] 0.9351116 0.9132030 0.8312321 0.4038730 0.9982857 0.9222976 0.9049660
#> [8] 0.9441381 0.6918399 0.8156703
#>
density(dist, 2)
#> [1] 8.595475e-02 1.353353e-01 1.253822e-01 1.013133e-12
density(dist, 2, log = TRUE)
#> [1] -2.453934 -2.000000 -2.076388 -27.617973
cdf(dist, 4)
#> [1] 0.8646647 0.9816844 0.9996645 1.0000000
quantile(dist, 0.7)
#> [1] 1.449551 1.203973 1.131734 1.037823