ralaplace: Generates an Asymmetric Laplace-distributed sample

View source: R/RcppExports.R

ralaplaceR Documentation

Generates an Asymmetric Laplace-distributed sample

Description

Returns a sample from an Asymetric Laplace distribution.

Usage

ralaplace(n, m = 0, al = 1, ar = 1)

Arguments

n

(int) - the size of the sample.

m

(numeric) - the location parameter.

al, ar

(numeric) - left and right scale parameters, respectively.

Details

The Asymmetric Laplace distribution is given by the two-sided exponential distribution given by the function:

f(x;a_l,a_r,m) = \frac{1}{A} e^{-|\frac{x-m}{a_l}| }, x < m

f(x;a_l,a_r,m) = \frac{1}{A} e^{-|\frac{x-m}{a_r}| }, x > m

with:

A = a_l + a_r

The random sampling is done by inverse transform sampling.

Value

a numeric vector containing a random sample.

Examples

sample_gamma <- ralaplace(1000)

Rsubbotools documentation built on April 16, 2025, 5:10 p.m.