draw.laplace {UnivRNG} | R Documentation |
This function implements pseudo-random number generation for a Laplace (double exponential) distribution with pdf
f(x|\lambda,\alpha)=\frac{\lambda}{2}e^{-\lambda|x-\alpha|}
for \lambda
>0 where \alpha
and \lambda
are the location and scale parameters, respectively.
draw.laplace(nrep, alpha, lambda)
nrep |
Number of data points to generate. |
alpha |
Location parameter for the desired Laplace distribution. |
lambda |
Scale parameter for the desired Laplace distribution. |
A list of length five containing generated data, the theoretical mean, the empirical mean, the theoretical variance, and the empirical variance with names y, theo.mean, emp.mean, theo.var, and emp.var, respectively.
draw.laplace(nrep=100000, alpha=4, lambda=2)
draw.laplace(nrep=100000, alpha=-5, lambda=4)