dist.Laplace.Precision: Laplace Distribution: Precision Parameterization In LaplacesDemonR/LaplacesDemonCpp: C++ Extension for LaplacesDemon

Description

These functions provide the density, distribution function, quantile function, and random generation for the univariate, symmetric, Laplace distribution with location parameter mu and precision parameter tau, which is the inverse of the usual scale parameter, lambda.

Usage

 ```1 2 3 4``` ```dlaplacep(x, mu=0, tau=1, log=FALSE) plaplacep(q, mu=0, tau=1) qlaplacep(p, mu=0, tau=1) rlaplacep(n, mu=0, tau=1) ```

Arguments

 `x, q` These are each a vector of quantiles. `p` This is a vector of probabilities. `n` This is the number of observations, which must be a positive integer that has length 1. `mu` This is the location parameter mu. `tau` This is the precision parameter tau, which must be positive. `log` Logical. If `log=TRUE`, then the logarithm of the density is returned.

Details

• Application: Continuous Univariate

• Density: p(theta) = (tau/2) * exp(-tau*abs(theta-mu))

• Inventor: Pierre-Simon Laplace (1774)

• Notation 1: theta ~ Laplace(mu, tau^(-1))

• Notation 2: theta ~ L(mu, tau^(-1))

• Notation 3: p(theta) = Laplace(mu, tau^(-1))

• Notation 4: p(theta) = L(theta | mu, tau(-1))

• Parameter 1: location parameter mu

• Parameter 2: precision parameter tau > 0

• Mean: E(theta) = mu

• Variance: var(theta) = 2*tau^{-2}

• Mode: mode(theta) = mu

The Laplace distribution is also called the double exponential distribution, because it looks like two exponential distributions back to back with respect to location mu. It is also called the “First Law of Laplace”, just as the normal distribution is referred to as the “Second Law of Laplace”. The Laplace distribution is symmetric with respect to mu, though there are asymmetric versions of the Laplace distribution. The PDF of the Laplace distribution is reminiscent of the normal distribution; however, whereas the normal distribution is expressed in terms of the squared difference from the mean mu, the Laplace density is expressed in terms of the absolute difference from the mean, mu. Consequently, the Laplace distribution has fatter tails than the normal distribution. It has been argued that the Laplace distribution fits most things in nature better than the normal distribution. Elsewhere, there are a large number of extensions to the Laplace distribution, including asymmetric versions and multivariate versions, among many more. These functions provide the precision parameterization for convenience and familiarity in Bayesian inference.

Value

`dlaplacep` gives the density, `plaplacep` gives the distribution function, `qlaplacep` gives the quantile function, and `rlaplacep` generates random deviates.

Author(s)

Statisticat, LLC. [email protected]

See Also

`dalaplace`, `dexp`, `dlaplace`, `dmvl`, `dnorm`, `dnormp`, and `dnormv`.

Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```library(LaplacesDemonCpp) x <- dlaplacep(1,0,1) x <- plaplacep(1,0,1) x <- qlaplacep(0.5,0,1) x <- rlaplacep(100,0,1) #Plot Probability Functions x <- seq(from=-5, to=5, by=0.1) plot(x, dlaplacep(x,0,0.5), ylim=c(0,1), type="l", main="Probability Function", ylab="density", col="red") lines(x, dlaplacep(x,0,1), type="l", col="green") lines(x, dlaplacep(x,0,2), type="l", col="blue") legend(2, 0.9, expression(paste(mu==0, ", ", tau==0.5), paste(mu==0, ", ", tau==1), paste(mu==0, ", ", tau==2)), lty=c(1,1,1), col=c("red","green","blue")) ```

LaplacesDemonR/LaplacesDemonCpp documentation built on May 9, 2017, 4:18 a.m.