Learn R Programming

disclap (version 1.5.1)

Discrete Laplace distribution: 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

Value

'ddisclap' gives the probability mass, 'pdisclap' gives the distribution function, and 'rdisclap' generates random deviates.

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.

See Also

DiscreteLaplace

Examples

Run this code
# NOT RUN {
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)")
# }

Run the code above in your browser using DataLab