Laplace distribution

Share:

Description

density and random generation for the Laplace distribution of mean 'mu' and scale parameter 'b'

Usage

1
2
dlaplace(x, mu=0, b=1)
rlaplace(n, mu=0, b=1)

Arguments

x

vector of quantiles.

n

number of observations.

mu

mean. Should be a single value. Defaults to 0.

b

scale. Should be a single value. Defaults to 1.

Details

The Laplace density function is parameterized as:

exp(-|x-mu|/b)/(2b)

Value

Returns a vector of n draws from a Laplace distribution

Author(s)

Julien Stirnemann <j.stirnemann@gmail.com>

Examples

1
2
3
4
5
6
7
set.seed(1234)

n=1000
x <- rchisq(n,3)
b=0.4
e <- rlaplace(n, 0, b)
y <- x + e  #noisy observations with laplace noise