rlaplace_truncated_centered: Generates centered laplace variables with scale 1.

Description Usage Arguments Details Value Examples

View source: R/rand_gen.R

Description

Generates centered laplace variables with scale 1.

Usage

1

Arguments

n

An integer, the number of samples to return.

lo

A double, the lower limit of the distribution.

hi

A double, the upper limit of the distribution.

Details

Returns n random variables from the truncated laplace distribution with density proportional to exp(-|x|) on [lo,hi].

Value

n random variables from the truncated laplace distribution.

Examples

1
2
3
4
5
6
7
hist(rlaplace_truncated_centered(1e4, -Inf, Inf), breaks=200)
hist(rlaplace_truncated_centered(1e4, 0, Inf), breaks=200)
hist(rlaplace_truncated_centered(1e4, 10, 12), breaks=200)
hist(rlaplace_truncated_centered(1e4, -2, 2), breaks=200)
hist(rlaplace_truncated_centered(1e4, -10, 0), breaks=200)
hist(rlaplace_truncated_centered(1e4, -100, Inf), breaks=200)
hist(rlaplace_truncated_centered(1e4, -100, -95), breaks=200)

genscore documentation built on April 28, 2020, 1:06 a.m.