dist_weibull(shape, scale)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.0852802028 0.0721762842 0.0005715019 0.0297972762 1.6410002010
#> [6] 0.1259473345 0.1699736469 0.0170148997 0.2431219929 0.3184940280
#>
#> [[2]]
#> [1] 3.78318937 0.33081228 0.42058674 0.79004842 0.09009796 0.20194431
#> [7] 0.20066732 0.70646919 1.34178841 1.72492322
#>
#> [[3]]
#> [1] 0.9094476 1.5523666 0.7303768 2.2156996 0.2795832 1.5577905 1.4099761
#> [8] 1.6115545 0.1963258 0.5694115
#>
#> [[4]]
#> [1] 0.8749446 0.6402453 1.0275787 1.2455931 0.8065732 0.9555621 0.8931664
#> [8] 1.1245075 0.9829899 0.6877621
#>
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