glm.hP {DGLMExtPois} | R Documentation |
Fit a hyper-Poisson Double Generalized Linear Model
Description
The glm.hP
function is used to fit a hyper-Poisson double generalized
linear model with a log-link for the mean (mu
) and the dispersion
parameter (gamma
).
Usage
glm.hP(
formula.mu,
formula.gamma,
init.beta = NULL,
init.delta = NULL,
data,
weights,
subset,
na.action,
maxiter_series = 1000,
tol = 0,
offset,
opts = NULL,
model.mu = TRUE,
model.gamma = TRUE,
x = FALSE,
y = TRUE,
z = FALSE
)
Arguments
formula.mu |
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. |
formula.gamma |
regression formula linked to |
init.beta |
initial values for regression coefficients of |
init.delta |
initial values for regression coefficients of |
data |
an optional data frame, list or environment (or object that can
be coerced by |
weights |
an optional vector of ‘prior weights’ to be used in the
fitting process. Should be |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
na.action |
a function which indicates what should happen when the data
contain |
maxiter_series |
Maximum number of iterations to perform in the calculation of the normalizing constant. |
tol |
tolerance with default zero meaning to iterate until additional terms to not change the partial sum in the calculation of the normalizing constant. |
offset |
this can be used to specify an a priori known component to be
included in the linear predictor during fitting. This should be |
opts |
a list with options to the optimizer,
|
model.mu |
a logical value indicating whether the mu model frame should be included as a component of the returned value. |
model.gamma |
a logical value indicating whether the gamma model frame should be included as a component of the returned value. |
x |
logical value indicating whether the mu model matrix used in the fitting process should be returned as a component of the returned value. |
y |
logical value indicating whether the response vector used in the fitting process should be returned as a component of the returned value. |
z |
logical value indicating whether the gamma model matrix used in the fitting process should be returned as a component of the returned value. |
Details
Fit a hyper-Poisson double generalized linear model using as optimizer the
NLOPT_LD_SLSQP algorithm of function nloptr
.
Value
glm.hP
returns an object of class "glm_hP"
. The
function summary
can be used to obtain or print a
summary of the results.
The generic accessor functions coef
,
fitted.values
and residuals
can
be used to extract various useful features of the value returned by
glm.hP
.
weights
extracts a vector of weights, one for each case in the fit
(after subsetting and na.action
).
An object of class "glm_hP"
is a list containing at least the
following components:
coefficients |
a named vector of coefficients. |
residuals |
the residuals, that is response minus fitted values. |
fitted.values |
the fitted mean values. |
linear.predictors |
the linear fit on link scale. |
call |
the matched call. |
offset |
the offset vector used. |
weights |
the weights initially supplied, a
vector of |
df.residual |
the residual degrees of freedom. |
df.null |
the residual degrees of freedom for the null model. |
y |
if requested (the default) the y vector used. |
matrix.mu |
if requested, the mu model matrix. |
matrix.gamma |
if requested, the gamma model matrix. |
model.mu |
if requested (the default) the mu model frame. |
model.gamma |
if requested (the default) the gamma model frame. |
nloptr |
an object of class |
References
Antonio J. Saez-Castillo and Antonio Conde-Sanchez (2013). "A hyper-Poisson regression model for overdispersed and underdispersed count data", Computational Statistics & Data Analysis, 61, pp. 148–157.
S. G. Johnson (2018). The nlopt nonlinear-optimization package
Examples
## Fit model
Bids$size.sq <- Bids$size ^ 2
fit <- glm.hP(formula.mu = numbids ~ leglrest + rearest + finrest +
whtknght + bidprem + insthold + size + size.sq + regulatn,
formula.gamma = numbids ~ 1, data = Bids)
## Summary of the model
summary(fit)
## To see the termination condition of the optimization process
fit$nloptr$message
## To see the number of iterations of the optimization process
fit$nloptr$iterations