knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

cmpreg: Reparametrized COM-Poisson Regression Models

Travis build status

Eduardo E. R. Junior - jreduardo@usp.br, IME-USP

The cmpreg package contains functions to fit Conway-Maxwell-Poisson (COM-Poisson) models with varying dispersion (model mean and dispersion parameters as functions of covariates.) in the mean-type parametrization proposed by Ribeiro Jr, et al. 2018 . The functions to computate the normalizing constant are written in C++, so the computations is reasonably fast.

Joint work with Walmes M. Zeviani and Clarice G.B. Demétrio.

Installation

You can install the development version of cmpreg from GitHub with:

# install.packages("devtools")
devtools::install_github("jreduardo/cmpreg")

Usage and example

Basically, this package implements methods similar to those related to glm objects. The main function is cmp(...).

library(cmpreg)

# Fit model ------------------------------------------------------------
model <- cmp(formula = ninsect ~ extract,
             dformula = ~extract,
             data = sitophilus)

# Methods --------------------------------------------------------------

print(model)

summary(model)

equitest(model)

# Predict new data -----------------------------------------------------
newdf <- sitophilus[c(1, 11, 21, 31), -2, drop = FALSE]
predict(model,
        newdata = newdf,
        what = "all",
        type = "response",
        se.fit = TRUE,
        augment_data = TRUE)

Currently, the methods implemented for "cmpreg" objects are

methods(class = "cmpreg")

Related projects

There are other R packages to deal with COM-Poisson models that have somehow contributed to the writing of cmpreg.

License

The gammacount package is licensed under the GNU General Public License, version 3, see file LICENSE.md, © 2019 E. E., Ribeiro Jr.



jreduardo/cmpreg documentation built on May 14, 2019, 11:05 p.m.