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] 3.724355 7.432998 6.580928 4.839895 7.347398 9.518203 -1.524048
#> [8] 5.274608 9.105718 2.953511
#>
#> [[2]]
#> [1] 0.6391895 12.1972645 14.5751780 9.0928444 18.3878195 12.4067875
#> [7] 8.4443315 20.3452265 8.6495240 8.7271871
#>
#> [[3]]
#> [1] 10.936644 10.538630 9.936112 8.860270 19.591185 3.530419 9.476767
#> [8] 18.748411 11.604186 4.269333
#>
#> [[4]]
#> [1] 6.421523 10.586980 8.613862 3.333075 7.154727 12.556554 8.337592
#> [8] 8.238406 6.382433 6.285357
#>
#> [[5]]
#> [1] 0.8136582 2.5203872 1.5520066 2.1138336 1.0700558 2.3728112
#> [7] 2.8408122 5.7271590 -0.1118496 0.4188451
#>
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