Model Wrappers for Poisson Regression

Bindings for Poisson regression models for use with the 'parsnip' package. Models include simple generalized linear models, Bayesian models, and zero-inflated Poisson models (Zeileis, Kleiber, and Jackman (2008) ).


poissonreg Six fishes, each in a different color: red, green, orange, purple, yellow, blue.

R-CMD-check CRANstatus Codecov testcoverage Lifecycle:experimental

poissonreg enables the parsnip package to fit various types of Poisson regression models including ordinary generalized linear models, simple Bayesian models (via rstanarm), and two zero-inflated Poisson models (via pscl).

Installation

You can install the released version of poissonreg from CRAN with:

install.packages("poissonreg")

Install the development version from GitHub with:

# install.packages("pak")
pak::pak("tidymodels/poissonreg")

Available Engines

The poissonreg package provides engines for the models in the following table.

model engine mode
poisson_reg glm regression
poisson_reg hurdle regression
poisson_reg zeroinfl regression
poisson_reg glmnet regression
poisson_reg stan regression

Example

A log-linear model for categorical data analysis:

library(poissonreg)

# 3D contingency table from Agresti (2007):
poisson_reg() |>
  set_engine("glm") |>
  fit(count ~ (.)^2, data = seniors)
#> parsnip model object
#> 
#> 
#> Call:  stats::glm(formula = count ~ (.)^2, family = stats::poisson, 
#>     data = data)
#> 
#> Coefficients:
#>               (Intercept)               marijuanayes  
#>                    5.6334                    -5.3090  
#>              cigaretteyes                 alcoholyes  
#>                   -1.8867                     0.4877  
#> marijuanayes:cigaretteyes    marijuanayes:alcoholyes  
#>                    2.8479                     2.9860  
#>   cigaretteyes:alcoholyes  
#>                    2.0545  
#> 
#> Degrees of Freedom: 7 Total (i.e. Null);  1 Residual
#> Null Deviance:       2851 
#> Residual Deviance: 0.374     AIC: 63.42

Contributing

This project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("poissonreg")

1.0.2 by Hannah Frick, 6 months ago


https://github.com/tidymodels/poissonreg, https://poissonreg.tidymodels.org/


Report a bug at https://github.com/tidymodels/poissonreg/issues


Browse source code at https://github.com/cran/poissonreg


Authors: Max Kuhn [aut] , Hannah Frick [aut, cre] (ORCID: , Posit Software , PBC [cph, fnd] (ROR: <https://ror.org/03wc8by49>)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports dplyr, generics, purrr, rlang, stats, tibble, tidyr

Depends on parsnip

Suggests covr, glmnet, pscl, rstanarm, spelling, testthat


Imported by offsetreg.

Suggested by tidyAML, tidysynthesis.


See at CRAN