Last chance! 50% off unlimited learning
Sale ends in
These functions provide the density, distribution function, quantile
function, and random generation for the univariate, symmetric, Laplace
distribution with location parameter
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)
These are each a vector of quantiles.
This is a vector of probabilities.
This is the number of observations, which must be a positive integer that has length 1.
This is the location parameter
This is the precision parameter
Logical. If log=TRUE
, then the logarithm of the
density is returned.
dlaplacep
gives the density,
plaplacep
gives the distribution function,
qlaplacep
gives the quantile function, and
rlaplacep
generates random deviates.
Application: Continuous Univariate
Density:
Inventor: Pierre-Simon Laplace (1774)
Notation 1:
Notation 2:
Notation 3:
Notation 4:
Parameter 1: location parameter
Parameter 2: precision parameter
Mean:
Variance:
Mode:
The Laplace distribution is also called the double exponential
distribution, because it looks like two exponential distributions back to
back with respect to location
# NOT RUN {
library(LaplacesDemon)
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"))
# }
Run the code above in your browser using DataLab