trunc_laplace_distribution: The truncated Laplace distribution

Description Usage Arguments Examples

Description

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

Usage

1
2
3
4
5
dtrunclaplace(x, mean, scale, lower, upper)

ptrunclaplace(q, mean, scale, lower, upper)

rtrunclaplace(n, mean, scale, lower, upper)

Arguments

x,

q vector of quantiles

mean

vector of means

scale

vector of scale parameters (> 0)

lower

lower bound of distribution

upper

upper bound of distribution

n

number of observations. If length(n) > 1, the length is taken to be the number required

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# Compare the distribution of random angles from a truncated
# Laplace versus those from a standard Laplace distribution.
N <- 1000
as <- rlaplace(N, mean=0 scale=1.0)
at <- rtrunclaplace(N, mean=0, scale=1.0, lower=-pi/2, upper=pi/2)

library(ggplot2)
dat <- data.frame(angle = c(as, at), distribution = rep(c("standard", "truncated"), each=N))
ggplot() +
  geom_histogram(data=dat, aes(x=angle, fill=distribution), position="dodge", binwidth=pi/10) +
  theme_bw()

## End(Not run)

mbedward/walkies documentation built on May 22, 2019, 12:19 p.m.