Learn R Programming

bda (version 10.1.9)

laplace: The Laplace (Double Exponential) Distribution

Description

Density, distribution function, quantile function and random generation for the Laplace (double exponential) distribution with mean mu and rate rate (i.e., mean 1/rate).

Usage

dlap(x, mu=0, rate=1)
plap(q, mu=0, rate=1)
qlap(p, mu=0, rate=1)
rlap(n, mu=0, rate=1)
fitlap(x,mu)

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

n

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

mu

vector of means.

rate

vector of rates.

Value

dlap gives the density, plap gives the distribution function, qlap gives the quantile function, and rlap generates random deviates.

Details

If mu is not specified, it assumes the default value of 0.

If rate is not specified, it assumes the default value of 1.

See Also

exp for the exponential function.

Distributions for other standard distributions, including dgamma for the gamma distribution and dexp for the exponential distribution. dweibull for the Weibull distribution, both of which generalize the exponential.

Examples

Run this code
# NOT RUN {
  dlap(100)
  x <- rlap(1000,mu=0, rate=0.5)
  x0 = seq(-7,7, length=100)
  fitlap(x)
  plot(density(x), xlim=c(-7,7), ylim=c(0,0.35))
  (out = fitlap(x))
  lines(dlap(x0, out$mu, out$rate)~x0, col=2, lty=2)
  (out = fitlap(x, mu=0))
  lines(dlap(x0, out$mu, out$rate)~x0, col=4, lty=2)
# }

Run the code above in your browser using DataLab