Logistic {stats} | R Documentation |
The Logistic Distribution
Description
Density, distribution function, quantile function and random
generation for the logistic distribution with parameters
location
and scale
.
Usage
dlogis(x, location = 0, scale = 1, log = FALSE)
plogis(q, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE)
qlogis(p, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE)
rlogis(n, location = 0, scale = 1)
Arguments
x , q |
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations. If |
location , scale |
location and scale parameters. |
log , log.p |
logical; if |
lower.tail |
logical; if |
Details
If location
or scale
are omitted, they assume the
default values of 0
and 1
respectively.
The logistic distribution with location
= \mu
and
scale
= \sigma
has distribution function
F(x) = \frac{1}{1 + e^{-(x-\mu)/\sigma}}%
and density
f(x)= \frac{1}{\sigma}\frac{e^{(x-\mu)/\sigma}}{(1 + e^{(x-\mu)/\sigma})^2}%
It is a long-tailed distribution with mean \mu
and variance
\pi^2/3 \sigma^2
.
Value
dlogis
gives the density,
plogis
is the cumulative distribution function, and
qlogis
is the quantile function of the logistic distribution.
rlogis
generates random deviates.
The length of the result is determined by n
for
rlogis
, and is the maximum of the lengths of the
numerical arguments for the other functions.
The numerical arguments other than n
are recycled to the
length of the result. Only the first elements of the logical
arguments are used.
Note
qlogis(p)
is the same as the well known ‘logit’
function, logit(p) = \log p/(1-p)
,
and plogis(x)
has consequently been called the ‘inverse logit’.
The distribution function is a rescaled hyperbolic tangent,
plogis(x) == (1+ tanh(x/2))/2
, and it is called a
sigmoid function in contexts such as neural networks.
Source
[dpq]logis
are calculated directly from the definitions.
rlogis
uses inversion.
References
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
Johnson, N. L., Kotz, S. and Balakrishnan, N. (1995) Continuous Univariate Distributions, volume 2, chapter 23. Wiley, New York.
See Also
Distributions for other standard distributions.
Examples
var(rlogis(4000, 0, scale = 5)) # approximately (+/- 3)
pi^2/3 * 5^2