Learn R Programming

extraDistr (version 1.8.1)

Skellam: Skellam distribution

Description

Probability mass function and random generation for the Skellam distribution.

Usage

dskellam(x, mu1, mu2, log = FALSE)
rskellam(n, mu1, mu2)

Arguments

x
vector of quantiles.
mu1, mu2
positive valued parameters.
log
logical; if TRUE, probabilities p are given as log(p).
n
number of observations. If length(n) > 1, the length is taken to be the number required.

Details

If $X$ and $Y$ follow Poisson distributions with means $\mu[1]$ and $\mu[2]$, than $X-Y$ follows Skellam distribution parametrized by $\mu[1]$ and $\mu[2]$.

Probability mass function $$ f(x) = e^{-(\mu_1\!+\!\mu_2)} \left(\frac{\mu_1}{\mu_2}\right)^{k/2}\!\!I_{k}(2\sqrt{\mu_1\mu_2}) $$

References

Karlis, D., & Ntzoufras, I. (2006). Bayesian analysis of the differences of count data. Statistics in medicine, 25(11), 1885-1905.

Examples

Run this code

x <- rskellam(1e5, 5, 13)
xx <- -40:40
plot(prop.table(table(x)), type = "h")
lines(xx, dskellam(xx, 5, 13), col = "red")

Run the code above in your browser using DataLab