Description Usage Arguments Details Value Author(s) References See Also Examples
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
1 2 3 4 5 | ddlaplace2(x, p, q)
palaplace2(x, p, q)
pdlaplace2(x, p, q)
qdlaplace2(prob, p, q)
rdlaplace2(n, p, q)
|
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 |
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=…, -2, -1
and
P(X=x;p,q)=\frac{\log q}{\log (pq)}p^{x}(1-p) for x=0, 1, 2, …
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≥q 0
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.
Alessandro Barbiero, Riccardo Inchingolo
A. Barbiero, An alternative discrete Laplace distribution, Statistical Methodology, 16: 47-67
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # 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))
|
[1] 0.06971023 0.11241413 0.16200599 0.25682299 0.25000000 0.15409380 0.11340420
[8] 0.08993130 0.06273921
[1] 0.0002336332 0.0005191849 0.0011537442 0.0025638761 0.0056975024
[6] 0.0126611164 0.0281358143 0.0625240318 0.1389422929 0.3087606509
[11] 0.5161324557 0.6612927190 0.7629049033 0.8340334323 0.8838234026
[16] 0.9186763818 0.9430734673 0.9601514271 0.9721059990 0.9804741993
[21] 0.9863319395
[1] 0.842207
[1] 0.8340334
[1] -1 0 0 0 1 1 2 3 5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.