The logitnormal distribution is useful as a prior density for variables that are bounded between 0 and 1, such as proportions. The following figure displays its density for various combinations of parameters mu (panels) and sigma (lines).
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
Example: Plot the cumulative distribution
The moments have no analytical solution. This package estimates them by numerical integration:
Example: estimate mean and standard deviation.
## mean var
## 0.63812093 0.01208171
The mode is found by setting derivatives to zero and optimizing the resulting equation: logit(x) = σ2(2x − 1) + μ.
Example: estimate the mode
## [1] 0.6641416
from upper quantile and - mode (Maximum Likelihood Estimate) - mean (Expected value) - median
Example: estimate the parameters, with mode 0.7 and upper quantile 0.9
## mu sigma
## [1,] 0.7608886 0.464783
x <- seq(0,1, length.out=81)
d <- dlogitnorm(x, mu=theta[1,"mu"], sigma=theta[1,"sigma"])
plot(d~x,type="l")
abline(v=c(0.7,0.9), col="grey")
When increasing the σ
parameter, the distribution becomes eventually becomes bi-model,
i.e. has two maxima. The unimodal distribution for a given mode with
widest confidence intervals is obtained by function
twCoefLogitnormMLEFlat
.
## mu sigma
## [1,] 0.01213214 1.444962