ddlaplace2 {DiscreteLaplace}R Documentation

Probability mass function of the ADSL

Description

The function computes the probability mass function, the cumulative distribution function, the quantile function of the ADSL and provides random generation of samples from the same model

Usage

ddlaplace2(x, p, q)
palaplace2(x, p, q)
pdlaplace2(x, p, q)
qdlaplace2(prob, p, q)
rdlaplace2(n, p, q)

Arguments

x

vector of quantiles

p

the first parameter p in (0,1) of the ADSL

q

the second parameter q in (0,1) of the ADSL

prob

vector of probabilities

n

number of observations

Details

The probability mass funtion of the ADSL distribution is given by:

P(X=x;p,q)=\frac{\log p}{\log (pq)}q^{-(x+1)}(1-q) for x=\dots, -2, -1

and

P(X=x;p,q)=\frac{\log q}{\log (pq)}p^{x}(1-p) for x=0, 1, 2, \dots

Its cumulative distribution function is:

F(x;p,q)=\frac{\log p}{\log (pq)}q^{-(\lfloor x \rfloor+1)} for x<0

and

F(x;p,q)=1-\frac{\log q}{\log (pq)}p^{(\lfloor x \rfloor+1)} for x\geq 0

Value

ddlaplace2 returns the probability of x; pdlaplace2 returns the cumulate probability of x; qdlaplace2 returns the prob- quantile; rdlaplace2 returns a random sample of size n from ADSL.

Author(s)

Alessandro Barbiero, Riccardo Inchingolo

References

A. Barbiero, An alternative discrete Laplace distribution, Statistical Methodology, 16: 47-67

See Also

ddlaplace

Examples

# pmf
p <- 0.7
q <- 0.45
x <- -10:10
prob <- ddlaplace2(x, p, q)
plot(x, prob, type="h")
# swap the parameters
prob <- ddlaplace2(x, q, p)
plot(x, prob, type="h")
# letting p and q be vectors...
ddlaplace2(-4:4, 1:9/10, 9:1/10)
# cdf
pdlaplace2(x, p, q)
pdlaplace2(pi, p, q)
pdlaplace2(floor(pi), p, q)
# quantile function
qdlaplace(1:9/10, p, q)
# random generation
y <- rdlaplace2(n=1000, p, q)
plot(table(y))

[Package DiscreteLaplace version 1.1.1 Index]