pospoisson.RdFits a positive Poisson distribution.
pospoisson(link = "loglink", type.fitted = c("mean", "lambda",
"prob0"), expected = TRUE, ilambda = NULL, imethod = 1,
zero = NULL, gt.1 = FALSE)Link function for the usual mean (lambda) parameter of
an ordinary Poisson distribution.
See Links for more choices.
Logical.
Fisher scoring is used if expected = TRUE, else Newton-Raphson.
See CommonVGAMffArguments for information.
See CommonVGAMffArguments for details.
Logical.
Enforce lambda > 1? The default is to
enforce lambda > 0.
The positive Poisson distribution is the ordinary Poisson
distribution but with the probability of zero being zero. Thus the
other probabilities are scaled up (i.e., divided by \(1-P[Y=0]\)).
The mean, \(\lambda / (1 - \exp(-\lambda))\),
can be obtained by the extractor function fitted applied to
the object.
A related distribution is the zero-inflated Poisson, in which the
probability \(P[Y=0]\) involves another parameter \(\phi\).
See zipoisson.
Under- or over-flow may occur if the data is ill-conditioned.
An object of class "vglmff" (see vglmff-class).
The object is used by modelling functions such as vglm,
rrvglm and vgam.
Coleman, J. S. and James, J. (1961). The equilibrium size distribution of freely-forming groups. Sociometry, 24, 36–45.
This family function can handle multiple responses.
Yet to be done: a quasi.pospoisson which estimates a dispersion
parameter.
Gaitdpois,
gaitdpoisson,
posnegbinomial,
poissonff,
zapoisson,
zipoisson,
simulate.vlm,
otpospoisson,
Pospois.
# Data from Coleman and James (1961)
cjdata <- data.frame(y = 1:6, freq = c(1486, 694, 195, 37, 10, 1))
fit <- vglm(y ~ 1, pospoisson, data = cjdata, weights = freq)
Coef(fit)
#> lambda
#> 0.8924961
summary(fit)
#>
#> Call:
#> vglm(formula = y ~ 1, family = pospoisson, data = cjdata, weights = freq)
#>
#> Coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -0.11373 0.02678 -4.248 2.16e-05 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> Name of linear predictor: loglink(lambda)
#>
#> Log-likelihood: -2304.659 on 5 degrees of freedom
#>
#> Number of Fisher scoring iterations: 4
#>
#> No Hauck-Donner effect found in any of the estimates
#>
fitted(fit)
#> [,1]
#> 1 1.511762
#> 2 1.511762
#> 3 1.511762
#> 4 1.511762
#> 5 1.511762
#> 6 1.511762
pdata <- data.frame(x2 = runif(nn <- 1000)) # Artificial data
pdata <- transform(pdata, lambda = exp(1 - 2 * x2))
pdata <- transform(pdata, y1 = rgaitdpois(nn, lambda, truncate = 0))
with(pdata, table(y1))
#> y1
#> 1 2 3 4 5 6
#> 537 286 108 43 19 7
fit <- vglm(y1 ~ x2, pospoisson, data = pdata, trace = TRUE, crit = "coef")
#> Iteration 1: coefficients = 0.87505175, -1.16582910
#> Iteration 2: coefficients = 0.98859772, -1.80736456
#> Iteration 3: coefficients = 1.0136741, -1.9781525
#> Iteration 4: coefficients = 1.0150203, -1.9881407
#> Iteration 5: coefficients = 1.0150246, -1.9881733
#> Iteration 6: coefficients = 1.0150246, -1.9881733
coef(fit, matrix = TRUE)
#> loglink(lambda)
#> (Intercept) 1.015025
#> x2 -1.988173