[Stable]

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)

Arguments

location, scale

location and scale parameters.

Details

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.

See also

Examples

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]  6.188569  5.710968 11.304809  1.800018  2.778864  5.166084  1.250027
#>  [8]  7.978300  3.379552  3.730710
#> 
#> [[2]]
#>  [1]  6.798999 13.756778  4.238441  6.139690  7.325568  1.235022 10.080707
#>  [8]  1.837710  6.105048  2.029825
#> 
#> [[3]]
#>  [1] 18.450425  4.181901 21.671779  5.969050  7.885592 18.572442 15.697711
#>  [8] 21.040903  5.867102 16.984272
#> 
#> [[4]]
#>  [1]  4.300495  5.524305  5.563913  5.431653  9.654409  8.638391  4.903154
#>  [8]  4.662528 12.460462 10.127657
#> 
#> [[5]]
#>  [1] 1.7256570 4.1173580 0.5553411 3.1175891 0.5285271 1.9572341 0.1192819
#>  [8] 2.4961750 1.3551942 2.3998593
#> 

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