Description Usage Arguments Details Value See Also Examples
The logit and inverse-logit (also called the logistic function) are provided.
1 2 |
x |
This object contains real values that will be transformed to the interval [0,1]. |
p |
This object contains of probabilities p in the interval [0,1] that will be transformed to the real line. |
The logit
function is the inverse of the sigmoid or logistic
function, and transforms a continuous value (usually probability
p) in the interval [0,1] to the real line (where it is usually
the logarithm of the odds). The logit
function is log(p / (1 - p)).
The invlogit
function (called either the inverse logit or the
logistic function) transforms a real number (usually the logarithm of
the odds) to a value (usually probability p) in the interval
[0,1]. The invlogit
function is 1
/ (1 + exp(-x)).
If p is a probability, then p/(1-p) is the
corresponding odds, while the logit
of p is the logarithm
of the odds. The difference between the logits of two probabilities is
the logarithm of the odds ratio. The derivative of probability p
in a logistic function (such as invlogit
) is: (d / dx) = p * (1 - p).
In the LaplacesDemon package, it is common to re-parameterize a model
so that a parameter that should be in an interval can be updated from
the real line by using the logit
and invlogit
functions,
though the interval
function provides an
alternative. For example, consider a parameter theta
that must be in the interval [0,1]. The algorithms in
IterativeQuadrature
, LaplaceApproximation
,
LaplacesDemon
, PMC
, and
VariationalBayes
are unaware of the desired interval,
and may attempt theta outside of this interval. One
solution is to have the algorithms update logit(theta)
rather
than theta
. After logit(theta)
is manipulated by the
algorithm, it is transformed via invlogit(theta)
in the model
specification function, where theta in [0,1].
invlogit
returns probability p
, and
logit
returns x
.
interval
,
IterativeQuadrature
,
LaplaceApproximation
,
LaplacesDemon
,
plogis
,
PMC
,
qlogis
, and
VariationalBayes
.
1 2 3 4 | library(LaplacesDemon)
x <- -5:5
p <- invlogit(x)
x <- logit(p)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.