R functions for the evaluation of the logistic-normal integral using the methods proposed in Pirjol (2013)
In this paper the logistic-normal integral is defined as
The function
-
Its values for positive and negative argument
$z$ are related as$\varphi(z,t) + \varphi(-z,t)=1$ -
For any
$z\in \mathbb{R}$ , we have$\varphi(z+t,t)= e^{-z-\frac12 t} (1 - \varphi(z,t))$
Using
D. Pirjol, Addendum: The logistic-normal integral and its generalizations, Journal of Computational and Applied Mathematics 237, 460-469 (2013)
The function phiLogisticNormal(z,t,Nmax) evaluates
The function phiLNexact(t,k) with
The function phiLinInterp(x,t) computes
Generalized logistic-normal integrals
Define the generalized logistic-normal integrals
The functions
-
Even index
$j=0,2,4,\cdots$ can be evaluated exactly at$z_k=kt$ with$k\in \mathbb{Z}$ . For example$\varphi(0,t)=\frac12,\varphi_2(0,t)=\frac12 t$ -
Odd index
$j=1,3,5,\cdots$ can be evaluated exactly at$z_k=(k+1/2)t$ with$k\in \mathbb{Z}$ . For example$\varphi_1(\frac12,t)=0$
The derivatives of the logistic-normal integral can be expressed in terms of these functions. For example, the first few derivatives are given below.
Relation to moments of logistic-normal random variables
The logistic-normal random variable
# plot the logistic-normal integral
x <- seq(-5,5, 0.1)
n <- length(x)
d <- c()
for (i in 1:n) d <- c(d,phiLogisticNormal(x[i], 1.0, 10))
plot(d~x, type ="l",main="Logistic-normal integral (t=1)")
y <- seq(-5,5,1)
ex <- c()
for (i in 1:11) ex <- c(ex, phiLNexact(1.0,y[i]))
points(ex~y, type = "p", col="blue")
Numerical evaluation comparing with exact results (blue dots)
A more detailed comparison
# compare the Poisson summation formula with the exact evaluation (t=1.0 - 50.0)
t <- 1.0
v1 <- c()
v2 <- c()
for (k in 1:50) v1 <- c(v1,phiLNexact(t, k))
for (k in 1:50) v2 <- c(v2,phiLogisticNormal(k*t, t, 10))
v3 <- v1 - v2
vd <- data.frame("exact"=v1, "Poisson" = v2, "diff"=v3)
vd
Keeping N=10 terms in the Poisson sum, the error is reasonably small for
For small t, the exact evaluation gives the values of
The function varphi1(z,t,Nmax,eps) computes
The function momentsLogisticNorm(mu,sig,Nmax) computes the mean and variance of a logistic-normal random variable
> momentsLogisticNorm(0.6,0.5)
[1] 0.6381209 0.0120817