Overview
The skellam package provides functions for working with the Skellam distribution – the distribution of the difference between two independent Poisson random variables. It includes routines for:
- Calculating the probability mass function (
dskellam) - Computing the cumulative distribution function (
pskellam) - Determining quantiles (
qskellam) - Generating random variates (
rskellam) - Performing maximum likelihood estimation (
skellam.mle) - Conducting regression analysis under the Skellam model (
skellam.reg)
This package is designed to offer enhanced numerical accuracy and robust handling of a wide range of parameter values.
Installation
Install the latest stable version from CRAN:
install.packages("skellam")Alternatively, install the development version from GitHub:
# install.packages("remotes") # Uncomment if needed remotes::install_github("monty-se/skellam")
Usage
Distribution Functions
dskellam(x, lambda1, lambda2 = lambda1, log = FALSE)
Returns the (log) density of the Skellam distribution.
pskellam(q, lambda1, lambda2 = lambda1, lower.tail = TRUE, log.p = FALSE)
Computes the (log) cumulative distribution function.
qskellam(p, lambda1, lambda2 = lambda1, lower.tail = TRUE, log.p = FALSE)
Returns the quantile function for the Skellam distribution.
rskellam(n, lambda1, lambda2 = lambda1)
Generates random variates following the Skellam distribution.
Additional Functionalities
skellam.mle(x)Performs maximum likelihood estimation (MLE) for the Skellam distribution parameters based on observed differences.
skellam.reg(y, x)
Fits a regression model assuming a Skellam distribution, using an exponential link to ensure positivity of the rate parameters.
Theoretical Background
If