Poisson Regression
poissonff.RdFamily function for a generalized linear model fitted to Poisson responses.
Arguments
- link
Link function applied to the mean or means. See
Linksfor more choices and information.
- parallel
A logical or formula. Used only if the response is a matrix.
- imu, imethod
Currently, if
weightsare specified thenimethod = 2is effectively called, which invokesweighted.mean. SeeCommonVGAMffArgumentsfor more information.- zero
Can be an integer-valued vector specifying which linear/additive predictors are modelled as intercepts only. The values must be from the set {1,2,...,\(M\)}, where \(M\) is the number of columns of the matrix response. See
CommonVGAMffArgumentsfor more information.- bred, earg.link
Details at
CommonVGAMffArguments. Settingbred = TRUEshould work for multiple responses and all VGAM link functions; it has been tested forloglink,identitybut further testing is required.- type.fitted, percentiles
Details at
CommonVGAMffArguments.- bhhh, oim.bhhh
Details at
CommonVGAMffArguments.
Details
\(M\) defined above is the number of linear/additive predictors.
With overdispersed data try negbinomial.
Value
An object of class "vglmff" (see
vglmff-class).
The object is used by modelling functions
such as
vglm, vgam,
rrvglm, cqo,
and cao.
References
McCullagh, P. and Nelder, J. A. (1989). Generalized Linear Models, 2nd ed. London: Chapman & Hall.
Note
This function will handle a matrix response automatically.
Regardless of whether the dispersion
parameter is to be estimated or not, its
value can be seen from the output from the
summary() of the object.
Warning
With multiple responses, assigning a known dispersion parameter for each response is not handled well yet. Currently, only a single known dispersion parameter is handled well.
See also
Links,
hdeff.vglm,
negbinomial,
genpoisson1,
genpoisson2,
genpoisson0,
gaitdpoisson,
zipoisson,
N1poisson,
pospoisson,
skellam,
mix2poisson,
cens.poisson,
ordpoisson,
amlpoisson,
inv.binomial,
simulate.vlm,
loglink,
polf,
rrvglm,
cqo,
cao,
binomialff,
poisson,
Poisson,
poisson.points,
ruge,
V1,
V2,
residualsvglm,
margeff.
Examples
poissonff()
#> Family: poissonff
#> Informal classes: poissonff, VGAMglm, VGAMcategorical
#>
#> Poisson distribution
#>
#> Link: loglink(lambda)
#> Variance: lambda
set.seed(123)
pdata <- data.frame(x2 = rnorm(nn <- 100))
pdata <- transform(pdata, y1 = rpois(nn, exp(1 + x2)),
y2 = rpois(nn, exp(1 + x2)))
(fit1 <- vglm(cbind(y1, y2) ~ x2, poissonff, pdata))
#>
#> Call:
#> vglm(formula = cbind(y1, y2) ~ x2, family = poissonff, data = pdata)
#>
#>
#> Coefficients:
#> (Intercept):1 (Intercept):2 x2:1 x2:2
#> 0.9175762 1.0204439 1.0471179 1.0084276
#>
#> Degrees of Freedom: 200 Total; 196 Residual
#> Residual deviance: 235.6729
#> Log-likelihood: -387.3006
(fit2 <- vglm(y1 ~ x2, poissonff(bred = TRUE), pdata))
#>
#> Call:
#> vglm(formula = y1 ~ x2, family = poissonff(bred = TRUE), data = pdata)
#>
#>
#> Coefficients:
#> (Intercept) x2
#> 0.9203612 1.0466136
#>
#> Degrees of Freedom: 100 Total; 98 Residual
#> Residual deviance: 116.6895
#> Log-likelihood: -191.1954
coef(fit1, matrix = TRUE)
#> loglink(E[y1]) loglink(E[y2])
#> (Intercept) 0.9175762 1.020444
#> x2 1.0471179 1.008428
coef(fit2, matrix = TRUE)
#> loglink(lambda)
#> (Intercept) 0.9203612
#> x2 1.0466136
nn <- 200
cdata <- data.frame(x2 = rnorm(nn), x3 = rnorm(nn), x4 = rnorm(nn))
cdata <- transform(cdata, lv1 = 0 + x3 - 2*x4)
cdata <- transform(cdata, lambda1 = exp(3 - 0.5 * (lv1-0)^2),
lambda2 = exp(2 - 0.5 * (lv1-1)^2),
lambda3 = exp(2 - 0.5 * ((lv1+4)/2)^2))
cdata <- transform(cdata, y1 = rpois(nn, lambda1),
y2 = rpois(nn, lambda2),
y3 = rpois(nn, lambda3))
if (FALSE) lvplot(p1, y = TRUE, lcol = 2:4, pch = 2:4, pcol = 2:4, rug = FALSE) # \dontrun{}