| Discrete Laplace distribution {disclap} | R Documentation |
Probability mass function, distribution function, and random generation for the discrete Laplace distribution with parameter 0 <= p < 1.
Description
Calculates the mass of observations from the discrete Laplace distribution.
Usage
ddisclap(x, p)
pdisclap(x, p, lower.tail = TRUE)
rdisclap(n, p)
Arguments
x |
vector of observations |
p |
the parameter with 0 <= p < 1 |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. |
n |
number of observations to generate |
Details
The probability mass function for the discrete Laplace distribution with parameter 0 < p < 1 is given by P(X = x) = \frac{1-p}{1+p} p^x for x \in \mathbf{Z}.
If x is a vector, then p must have either length 1 or the same length as x. If p has length 1, then the value will be reused for all values in x.
Value
'ddisclap' gives the probability mass, 'pdisclap' gives the distribution function, and 'rdisclap' generates random deviates.
Author(s)
Mikkel Meyer Andersen <mikl@math.aau.dk> and Poul Svante Eriksen
See Also
Examples
p <- 0.3
xs <- (-4):4
probd <- ddisclap(xs, p)
data.frame(xs, probd)
plot(xs, probd, type = "l", xlab = "x", ylab = "P(X = x; p)")
[Package disclap version 1.5.1 Index]