ddisclap: Probability mass function, distribution function, and random...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/ddisclap.R

Description

Calculates the mass of observations from the discrete Laplace distribution.

Usage

1
2
3
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) = ((1-p)/(1+p))*p^x for x = ..., -1, 0, 1, ....

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

DiscreteLaplace

Examples

1
2
3
4
5
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)")

disclap documentation built on Jan. 27, 2022, 5:07 p.m.