Processing math: 100%

Using the ExtendedLaplace Package

David Saah & Tomasz Kozubowski

2025-05-23

Introduction

The ExtendedLaplace package provides tools for working with the Extended Laplace (EL) distribution, a generalization of the classical Laplace distribution. This distribution is characterized by four parameters: location μ, scale σ>0, and a uniform noise range δ>0.

The EL distribution arises as the sum Y=X+U where XLaplace(μ,σ) and UUniform(δ,δ).

Installation

To install the development version of this package from GitHub:

# install.packages("devtools")
devtools::install_github("saahdavid/ExtendedLaplace")

Functions

The package provides the following main functions:

Examples

Density

library(ExtendedLaplace)
curve(dEL(x, mu = 0, sigma = 1, delta = 1), from = -5, to = 5, ylab = "Density", xlab = 'y')

Distribution Function

curve(pEL(x, mu = 0, sigma = 1, delta = 1), from = -5, to = 5, ylab = "CDF", xlab = 'y')

Quantiles

qEL(c(0.025, 0.5, 0.975), mu = 0, sigma = 1, delta = 1)
# [1] -3.157172  0.000000  3.157172

Simulation

samples <- rEL(10000, mu = 0, sigma = 1, delta = 1)
hist(samples, probability = TRUE, breaks = 40, main = "Simulated EL Data", xlab = 'y')
curve(dEL(x, mu = 0, sigma = 1, delta = 1), add = TRUE, col = "navy", lwd = 2)

QQ-Plot

qqplotEL(samples, mu = 0, sigma = 1, delta = 1)

Theoretical Notes

The Extended Laplace distribution has the following form:

PDF

g(y)=14δ{eyμ+δσeyμδσ,y<μδ2eyμ+δσeyμδσ,μδy<μ+δeyμδσeyμ+δσ,yμ+δ

CDF

G(y)=14δ{σeyμ+δσσeyμδσ,y<μδ2(yμ+δ)+σeyμ+δσσeyμδσ,μδy<μ+δ4δ+σeyμ+δσσeyμδσ,yμ+δ.

The quantile function

For σ>0 and 0<u<1, we have Q(u)=μ+σz, where

z={log[4τu]log[eτeτ]for 0<u(1e2τ)/(4τ)zfor (1e2τ)/(4τ)u1(1e2τ)/(4τ)log[4τ(1u)]+log[eτeτ]for 1(1e2τ)/(4τ)u<1,

where τ=δ/σ and z is a unique solution of the equation: u=14τ[2(z+τ)eτ(ezez)],τzτ.

Session Info

sessionInfo()
# R version 4.4.3 (2025-02-28)
# Platform: x86_64-apple-darwin20
# Running under: macOS Sequoia 15.5
# 
# Matrix products: default
# BLAS:   /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRblas.0.dylib 
# LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
# 
# locale:
# [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
# 
# time zone: America/Los_Angeles
# tzcode source: internal
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] ExtendedLaplace_0.1.6
# 
# loaded via a namespace (and not attached):
#  [1] digest_0.6.37     R6_2.6.1          fastmap_1.2.0     xfun_0.51        
#  [5] splines_4.4.3     cachem_1.1.0      knitr_1.50        htmltools_0.5.8.1
#  [9] rmarkdown_2.29    stats4_4.4.3      lifecycle_1.0.4   cli_3.6.4        
# [13] sass_0.4.9        jquerylib_0.1.4   VGAM_1.1-13       compiler_4.4.3   
# [17] rstudioapi_0.17.1 tools_4.4.3       evaluate_1.0.3    bslib_0.9.0      
# [21] yaml_2.3.10       rlang_1.1.5       jsonlite_1.9.1

References

Saah, D. K., & Kozubowski, T. J. (2025).
A new class of extended Laplace distributions with applications to modeling contaminated Laplace data.
Journal of Computational and Applied Mathematics.
https://doi.org/10.1016/j.cam.2025.116588