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.8658619 10.3305153 6.3075558 5.1084827 5.5845942 7.4232965
#> [7] -1.9331378 0.6473872 3.3505919 4.4773425
#>
#> [[2]]
#> [1] 8.242745 6.025529 15.206772 15.418833 9.202131 10.201776 10.916190
#> [8] -0.232640 15.644106 4.768615
#>
#> [[3]]
#> [1] 14.7209662 8.0741974 13.0009167 6.9191037 -1.4026373 7.8970113
#> [7] 9.8700286 0.5636868 17.8939036 -5.1062678
#>
#> [[4]]
#> [1] 1.570022 5.698264 2.746287 6.103908 11.612174 7.486487 5.364641
#> [8] 10.789394 6.569626 4.660303
#>
#> [[5]]
#> [1] 3.5650681 3.1095549 0.8183330 1.3335869 1.3627772 1.1627231
#> [7] 2.5062814 0.8852229 -0.2424980 0.5363091
#>
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