# rlaplace_truncated: Generates laplace variables truncated to a finite union of... In genscore: Generalized Score Matching Estimators

## Description

Generates laplace variables truncated to a finite union of intervals.

## Usage

 `1` ```rlaplace_truncated(n, lefts, rights, m = 0, s = 1) ```

## Arguments

 `n` An integer, the number of samples to return. `lefts` A vector of numbers, must have the same length as `rights`. A non-empty vector of numbers (may contain `-Inf`), the left endpoints of a domain defined as a union of intervals. It is required that `lefts[i] <= rights[i] <= lefts[j]` for any `i < j`. `rights` A vector of numbers, must have the same length as `lefts`. A non-empty vector of numbers (may contain `Inf`), the right endpoints of a domain defined as a union of intervals. It is required that `lefts[i] <= rights[i] <= lefts[j]` for any `i < j`. `m` A number, the location parameter of the laplace distribution. `s` A number, the scale/dispersion parameter of the laplace distribution.

## Details

Returns `n` random variables from the truncated laplace distribution with density proportional to exp(-|x-m|/s) truncated to the domain defined by the union of [`lefts[i]`, `rights[i]`].

## Value

`n` random variables from the truncated laplace distribution.

## Examples

 ```1 2 3 4 5 6 7 8``` ```hist(rlaplace_truncated(1e4, -Inf, Inf), breaks=200) hist(rlaplace_truncated(1e4, c(0, 5), c(2, Inf), m=2, s=3), breaks=200) hist(rlaplace_truncated(1e4, c(-Inf, 0, 3), c(-3, 1, 12), m=8, s=4), breaks=200) hist(rlaplace_truncated(1e4, c(-5, 0), c(-2, 2), s=0.8), breaks=200) hist(rlaplace_truncated(1e4, c(-10, 1), c(-7, 10), m=-4), breaks=200) hist(rlaplace_truncated(1e4, c(-Inf, 100), c(-100, Inf), m=100), breaks=200) hist(rlaplace_truncated(1e4, c(-Inf, 100), c(-100, Inf), m=-100), breaks=200) hist(rlaplace_truncated(1e4, c(-100, -90), c(-95, -85), s=2), breaks=200) ```

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