Description Usage Arguments Details Value References See Also Examples

These functions provide the density, distribution function, quantile
function, and random generation for the univariate, skew discrete
Laplace distribution with parameters *p* and *q*.

1 2 3 4 | ```
dsdlaplace(x, p, q, log=FALSE)
psdlaplace(x, p, q)
qsdlaplace(prob, p, q)
rsdlaplace(n, p, q)
``` |

`x` |
This is a vector of data. |

`p` |
This is a scalar or vector of parameter |

`q` |
This is a scalar or vector of parameter |

`prob` |
This is a probability scalar or vector. |

`n` |
This is the number of observations, which must be a positive integer that has length 1. |

`log` |
Logical. If |

Application: Discrete Univariate

Density 1:

*p(theta) = (1-p)(1-q) / (1-pq)p^theta, theta=0,1,2,3,...*Density 2:

*p(theta) = (1-p)(1-q) / (1-pq)q^(|theta|),; x=0,-1,-2,-3,...*Inventor: Kozubowski, T.J. and Inusah, S. (2006)

Notation 1:

*theta ~ DL(p, q)*Notation 2:

*p(theta) = DL(theta | p, q)*Parameter 1:

*p in [0,1]*Parameter 2:

*q in [0,1]*Mean 1:

*E(theta) = (1 / (1-p)) - (1 / (1-q)) = (p / (1-p)) - (q / (1-q))*Mean 2:

*E(|theta|) = (q(1-p)^2+p(1-q)^2) / ((1-qp)(1-q)(1-p))*Variance:

*var(theta) = (1 / ((1-p)^2(1-q)^2))[(q(1-p)^3(1+q)+p(1-q)^3(1+p)) / (1-pq) - (p-q)^2]*Mode:

This is a discrete form of the skew-Laplace distribution. The symmetric
discrete Laplace distribution occurs when *p=q*. DL(p,0) is a
geometric distribution, and DL(0,q) is a geometric distribution of
non-positive integers. The distribution is degenerate when
DL(0,0). Since the geometric distribution is a discrete analog of the
exponential distribution, the distribution of the difference of two
geometric variables is a discrete Laplace distribution.

These functions are similar to those in the `DiscreteLaplace`

package.

`dslaplace`

gives the density,
`pslaplace`

gives the distribution function,
`qslaplace`

gives the quantile function, and
`rslaplace`

generates random deviates.

Kozubowski, T.J. and Inusah, S. (2006). "A Skew Laplace Distribution
on Integers". *AISM*, 58, p. 555–571.

`dalaplace`

,
`dexp`

,
`dlaplace`

,
`dlaplacep`

, and
`dslaplace`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
library(LaplacesDemonCpp)
x <- dsdlaplace(1,0.5,0.5)
x <- psdlaplace(1,0.5,0.5)
x <- qsdlaplace(0.5,0.5,0.5)
x <- rsdlaplace(5,0.5,0.5)
#Plot Probability Functions
x <- c(-3:3)
plot(x, dsdlaplace(x,0.5,0.5), ylim=c(0,0.6), type="l", main="Probability Function",
ylab="density", col="red")
lines(x, dsdlaplace(x,0.3,0.6), type="l", col="green")
lines(x, dsdlaplace(x,0.9,0.1), type="l", col="blue")
legend(-2.5, 0.5, expression(paste(p==0.5, ", ", q==0.5),
paste(p==0.3, ", ", q==0.6),
paste(p==0.9, ", ", q==0.1)),
lty=c(1,1,1), col=c("red","green","blue"))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.