A continuous distribution on the real line. For binary outcomes
the model given by \(P(Y = 1 | X) = F(X \beta)\) where
\(F\) is the Logistic cdf() is called logistic regression.
dist_logistic(location, scale)We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_logistic.html
In the following, let \(X\) be a Logistic random variable with
location = \(\mu\) and scale = \(s\).
Support: \(R\), the set of all real numbers
Mean: \(\mu\)
Variance: \(s^2 \pi^2 / 3\)
Probability density function (p.d.f):
$$ f(x) = \frac{e^{-\frac{x - \mu}{s}}}{s \left[1 + e^{-\frac{x - \mu}{s}}\right]^2} $$
Cumulative distribution function (c.d.f):
$$ F(x) = \frac{1}{1 + e^{-\frac{x - \mu}{s}}} $$
Moment generating function (m.g.f):
$$ E(e^{tX}) = e^{\mu t} B(1 - st, 1 + st) $$
for \(-1 < st < 1\), where \(B(a, b)\) is the Beta function.
dist <- dist_logistic(location = c(5,9,9,6,2), scale = c(2,3,4,2,1))
dist
#> <distribution[5]>
#> [1] Logistic(5, 2) Logistic(9, 3) Logistic(9, 4) Logistic(6, 2) Logistic(2, 1)
mean(dist)
#> [1] 5 9 9 6 2
variance(dist)
#> [1] 13.159473 29.608813 52.637890 13.159473 3.289868
skewness(dist)
#> [1] 0 0 0 0 0
kurtosis(dist)
#> [1] 1.2 1.2 1.2 1.2 1.2
generate(dist, 10)
#> [[1]]
#> [1] 8.2223978 -4.4679426 5.8098434 4.7912034 4.1133553 3.4858621
#> [7] -0.4602222 4.1015136 7.6100285 6.8622069
#>
#> [[2]]
#> [1] 1.690350 8.013465 1.288287 10.127270 11.033204 9.529907 12.832450
#> [8] 10.317185 2.028726 17.382650
#>
#> [[3]]
#> [1] 18.084640 12.677283 11.311742 8.619429 -5.320800 8.044197 6.840444
#> [8] 10.704457 15.753774 12.415708
#>
#> [[4]]
#> [1] 7.201262 4.122606 8.157090 9.128393 7.735058 3.694441 5.768837 1.629513
#> [9] 8.017381 8.397474
#>
#> [[5]]
#> [1] 5.0972523 1.3240557 1.0431446 1.5912701 0.8472879 1.4071233 1.2101524
#> [8] 4.0637497 0.6964656 1.2828856
#>
density(dist, 2)
#> [1] 0.07457323 0.02686172 0.03153231 0.05249679 0.25000000
density(dist, 2, log = TRUE)
#> [1] -2.595974 -3.617053 -3.456743 -2.947003 -1.386294
cdf(dist, 4)
#> [1] 0.3775407 0.1588691 0.2227001 0.2689414 0.8807971
quantile(dist, 0.7)
#> [1] 6.694596 11.541894 12.389191 7.694596 2.847298