| skellam.reg | R Documentation |
Fits a regression model assuming a Skellam distribution for the response variable.
skellam.reg(y, x)
y |
A vector of integers (positive or negative) |
x |
A matrix, vector or data.frame of covariates |
The response is modelled as y_i = Y_{1i} - Y_{2i} with
Y_{1i} \sim \mathrm{Poisson}(\lambda_{1i}) and
Y_{2i} \sim \mathrm{Poisson}(\lambda_{2i}), so that
param1 describes the rate of the counts that are added and
param2 the rate of the counts that are subtracted, as in
dskellam(y, lambda1, lambda2). Both rates use a log link,
\log\lambda_{ki} = x_i^\top\beta_k, with the same
covariates (an intercept is added).
The log-likelihood is computed with dskellam(log = TRUE) and
maximized by optim (BFGS) with the analytic gradient,
starting deterministically from the moment estimates of an intercept-only
model, so repeated calls give identical results. Standard errors come from
the inverse of the observed information (optimHess).
Observations with a missing response or covariate are removed with a
warning. A warning is also given if the optimizer does not converge or the
information matrix is not invertible (standard errors are then NA).
A list with components:
Maximized log-likelihood value
Matrix for \lambda_1 parameters:
Column 1: Estimated coefficients
Column 2: Standard errors
Column 3: Wald z statistics (coef/se)
Column 4: p-values (Wald test)
Matrix for \lambda_2 parameters (same structure as param1)
Michail Tsagris
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), 296.
Strackee, J.; van der Gon, J. J. D. (1962) The frequency distribution of the difference between two Poisson variates. Statistica Neerlandica 16(1), 17-23.
Karlis, D. and Ntzoufras, I. (2009) Bayesian modelling of football outcomes: using the Skellam's distribution for the goal difference. IMA Journal of Management Mathematics 20(2), 133-145.
set.seed(0)
x <- rnorm(100)
y1 <- rpois(100, exp(1 + 1 * x))
y2 <- rpois(100, exp(-1 + 1 * x))
y <- y1 - y2
skellam.reg(y, x) # param1 near (1, 1), param2 near (-1, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.