skellam {VGAM} | R Documentation |
Estimates the two parameters of a Skellam distribution by maximum likelihood estimation.
skellam(lmu1="loge", lmu2="loge", emu1=list(), emu2=list(), imu1=NULL, imu2=NULL, nsimEIM=100, parallel=FALSE, zero=NULL)
lmu1, emu1 |
Link function and extra argument for the mu1 parameter.
See |
lmu2, emu2 |
Link function and extra argument for the mu1 parameter.
See |
imu1, imu2 |
Optional initial values for the parameters.
See |
nsimEIM, parallel, zero |
See |
The Skellam distribution models the difference between two independent Poisson distributions. It has density function
f(y;mu1,mu2) = ( μ1 / mu_2 )^(y/2) * exp(-mu1-mu2 ) * I_y( 2 * sqrt(mu1*mu2))
where y is an integer, mu1 > 0, mu2 > 0. Here, I_v is the modified Bessel function of the first kind with order v.
The mean is mu1 - mu2 (returned as the fitted values) and the variance is mu1 + mu2. Simulated Fisher scoring is implemented.
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
and vgam
.
This VGAM family function seems fragile and very sensitive to the initial values. Use very cautiously!!
Numerical problems may occur for data if mu1 and/or mu2 are large.
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, 296.
sdata = data.frame(x = runif(nn <- 1000)) sdata = transform(sdata, mu1 = exp(1+x), mu2 = exp(1+x)) sdata = transform(sdata, y = rskellam(nn, mu1, mu2)) fit1 = vglm(y ~ x, skellam, sdata, trace=TRUE) fit2 = vglm(y ~ x, skellam(parallel=TRUE), sdata, trace=TRUE, crit="c") coef(fit1, matrix=TRUE) coef(fit2, matrix=TRUE) summary(fit1) # Likelihood ratio test for equal means: pchisq(2*(logLik(fit1)-logLik(fit2)), df=fit2@df.residual-fit1@df.residual, lower.tail=FALSE)