Skellam function

Skellam distribution

Skellam distribution

Probability mass function and random generation for the Skellam distribution.

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 XX and YY follow Poisson distributions with means μ[1]\mu[1] and μ[2]\mu[2], than XYX-Y follows Skellam distribution parametrized by μ[1]\mu[1] and μ[2]\mu[2].

Probability mass function

f(x)=e(μ1 ⁣+ ⁣μ2)(μ1μ2)k/2 ⁣ ⁣Ik(2μ1μ2)f(x)=exp((μ1+μ2))(μ1/μ2)(x/2)besselI(2sqrt(μ1μ2),x) f(x) = e^{-(\mu_1\!+\!\mu_2)} \left(\frac{\mu_1}{\mu_2}\right)^{k/2}\!\!I_{k}(2\sqrt{\mu_1\mu_2})f(x) = exp(-(\mu1+\mu2)) * (\mu1/\mu2)^(x/2) * besselI(2*sqrt(\mu1*\mu2), x)

Examples

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

References

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

Skellam, J.G. (1946). The frequency distribution of the difference between two Poisson variates belonging to different populations. Journal of the Royal Statistical Society, series A, 109(3), 26.

  • Maintainer: Tymoteusz Wolodzko
  • License: GPL-2
  • Last published: 2023-11-30