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 https://pkg.mitchelloharawild.com/distributional/, where the math will render nicely.
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 [1 + \exp(-(\frac{x - \mu}{s})) ]^2} $$
Cumulative distribution function (c.d.f):
$$ F(t) = \frac{1}{1 + e^{-(\frac{t - \mu}{s})}} $$
Moment generating function (m.g.f):
$$ E(e^{tX}) = e^{\mu t} \beta(1 - st, 1 + st) $$
where \(\beta(x, y)\) 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] 2.042966 4.874836 7.290527 3.325095 4.053014 1.979800 6.126906 5.480225
#> [9] 8.469634 6.417819
#>
#> [[2]]
#> [1] 10.364668 15.816521 6.628481 10.183631 11.513232 13.690590 19.146087
#> [8] 7.353285 14.093945 7.673410
#>
#> [[3]]
#> [1] 12.296804 11.465323 -5.896379 19.109511 25.752218 21.561935 4.946681
#> [8] 11.941056 15.240644 13.618906
#>
#> [[4]]
#> [1] 4.625294 13.833325 11.780740 6.076314 5.077891 6.787119 2.297071
#> [8] 6.871214 6.970989 2.690781
#>
#> [[5]]
#> [1] 0.777033716 1.955990441 0.986297688 6.320942231 2.658963327 2.248421580
#> [7] 2.422043353 0.565456589 1.474938941 0.008511925
#>
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