glm.CMP {DGLMExtPois}R Documentation

Fit a COM-Poisson Double Generalized Linear Model

Description

The glm.CMP function is used to fit a COM-Poisson double generalized linear model with a log-link for the mean (mu) and the dispersion parameter (nu).

Usage

glm.CMP(
  formula.mu,
  formula.nu,
  init.beta = NULL,
  init.delta = NULL,
  data,
  weights,
  subset,
  na.action,
  maxiter_series = 1000,
  tol = 0,
  offset,
  opts = NULL,
  model.mu = TRUE,
  model.nu = TRUE,
  x = FALSE,
  y = TRUE,
  z = FALSE
)

Arguments

formula.mu

regression formula linked to log(mu)

formula.nu

regression formula linked to log(nu)

init.beta

initial values for regression coefficients of beta.

init.delta

initial values for regression coefficients of delta.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which glm.CMP is called.

weights

an optional vector of ‘prior weights’ to be used in the fitting process. Should be NULL or a numeric vector.

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 NAs. The default is set by the na.action setting of options, and is na.fail if that is unset. The ‘factory-fresh’ default is na.omit. Another possible value is NULL, no action. Value na.exclude can be useful.

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 NULL or a numeric vector of length equal to the number of cases. One or more offset terms can be included in the formula instead or as well, and if more than one is specified their sum is used. See model.offset.

opts

a list with options to the optimizer, nloptr, that fits the model. See, the opts parameter of nloptr for further details.

model.mu

a logical value indicating whether the mu model frame should be included as a component of the returned value.

model.nu

a logical value indicating whether the nu 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 nu model matrix used in the fitting process should be returned as a component of the returned value.

Details

Fit a COM-Poisson double generalized linear model using as optimizer the NLOPT_LD_SLSQP algorithm of function nloptr.

Value

glm.CMP returns an object of class "glm_CMP". The function summary can be used to obtain or print a summary of the results. An object of class "glm_CMP" 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 1s if none were.

y

if requested (the default) the y vector used.

matrix.mu

if requested, the mu model matrix.

matrix.nu

if requested, the nu model matrix.

model.mu

if requested (the default) the mu model frame.

model.nu

if requested (the default) the nu model frame.

nloptr

an object of class "nloptr" with the result returned by the optimizer nloptr

References

Alan Huang (2017). "Mean-parametrized Conway–Maxwell–Poisson regression models for dispersed counts", Statistical Modelling, 17(6), pp. 359–380.

S. G. Johnson (2018). The nlopt nonlinear-optimization package

Examples

## Fit model
Bids$size.sq <- Bids$size^2
fit <- glm.CMP(formula.mu = numbids ~ leglrest + rearest + finrest +
               whtknght + bidprem + insthold + size + size.sq + regulatn,
               formula.nu = numbids ~ 1, data = Bids)

## Summary of the model
summary(fit)

## To see termination condition of the optimization process
fit$nloptr$message

## To see number of iterations of the optimization process
fit$nloptr$iterations

[Package DGLMExtPois version 0.2.3 Index]