Laplace Inverse Mills ratio: some properties

The Laplace Inverse Mills Ratio (LIMR) is defined as the ratio of the Laplace density, \(f(x)=\dfrac{1}{2}\exp(-\vert x \vert)\), divided by the Laplace cumulative distribution function, \(F\):

\[\begin{eqnarray} \operatorname{LIMR}(x) = \dfrac{f(x)}{F(x)},\,\,\, x \in {\mathbb R}. \end{eqnarray}\]

This quantity appears in median regression and survival analysis. The LIMR has the following properties:

\[ \operatorname{LIMR}^{'}(x) = \begin{cases} 0, &\text{ if }& x<0, \\ -\mbox{sign}(x) \operatorname{LIMR}(x) - \operatorname{LIMR}(x)^2,&\text{ if }& x>0,\\ \text{Undefined}, &\text{ if }& x=0. \end{cases}\] The R code below illustrates the behaviour of the LIMR and its first derivative.

References

  1. Normal Inverse Mills Ratio

  2. The Laplace distribution

Illustration in R

# Probability Density Function: location parameter mu and scale parameter sigma
dlap = function(x,mu=0,sigma=1,log=FALSE){
  log.den = - log(2) - log(sigma) - abs(x-mu)/sigma
  if(log) log.den
  else exp(log.den)
}

# Cumulative Distribution Function
plap = function(x,mu=0,sigma=1,log.p=FALSE){
    if(x<mu){
    log.cdf1 = -log(2) + (x-mu)/sigma
    if(log.p) return(log.cdf1)
    else return(exp(log.cdf1))
  }
  if(x>=mu){
      log.cdf2 = -log(2) + (-x-mu)/sigma
      if(log.p) log(1 - exp(log.cdf2))
      else 1 - exp(log.cdf2)
  }
}

# The Inverse Mills Ratio (IMR) function
LIMR <- Vectorize( function(x) exp( dlap(x,log=T) - plap(x,log.p = T) ) )
curve(LIMR, -15, 15, n = 10000, lwd = 2, cex.axis=1.5, cex.lab=1.5, xlab="x", ylab="LIMR", main = "Laplace Inverse Mills Ratio")

# First derivative of IMR
D <- Vectorize( function(x) -sign(x)*LIMR(x) - LIMR(x)^2 )
curve(D, -15, 15, n = 10000, lwd = 2, cex.axis=1.5, cex.lab=1.5, xlab="x", ylab="D", main = "First Derivative of LIMR")