Learn R Programming

RTMBdist (version 0.1.0)

laplace: Laplace distribution

Description

Density, distribution function, quantile function, and random generation for the Laplace distribution.

Usage

dlaplace(x, mu = 0, b = 1, log = FALSE)

plaplace(q, mu = 0, b = 1, lower.tail = TRUE, log.p = FALSE)

qlaplace(p, mu = 0, b = 1, lower.tail = TRUE, log.p = FALSE)

rlaplace(n, mu = 0, b = 1)

Value

dlaplace gives the density, plaplace gives the distribution function, qlaplace gives the quantile function, and rlaplace generates random deviates.

Arguments

x, q

vector of quantiles

mu

location parameter

b

scale parameter, must be positive.

log, log.p

logical; if TRUE, probabilities/ densities \(p\) are returned as \(\log(p)\).

lower.tail

logical; if TRUE, probabilities are \(P[X \le x]\), otherwise, \(P[X > x]\).

p

vector of probabilities

n

number of random values to return

Details

This implementation of dlaplace allows for automatic differentiation with RTMB.

Examples

Run this code
x <- rlaplace(1, 1, 1)
d <- dlaplace(x, 1, 1)
p <- plaplace(x, 1, 1)
q <- qlaplace(p, 1, 1)

Run the code above in your browser using DataLab