Learn R Programming

⚠️There's a newer version (1.0.1) of this package.Take me there.

poissonreg

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:

require("devtools")
install_github("tidymodels/poissonreg")

Example

A log-linear model for categorical data analysis:

library(poissonreg)
#> Loading required package: parsnip

# 3D contingency table from Agresti (2007): 
poisson_reg() %>% 
  set_engine("glm") %>% 
  fit(count ~ (.)^2, data = seniors)
#> parsnip model object
#> 
#> Fit time:  6ms 
#> 
#> 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.

Copy Link

Version

Install

install.packages('poissonreg')

Monthly Downloads

424

Version

0.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Max Kuhn

Last Published

October 28th, 2020

Functions in poissonreg (0.1.0)

predict_raw._fishnet

Model predictions across many sub-models
poisson_reg

General Interface for Poisson Regression Models
seniors

Alcohol, Cigarette, and Marijuana Use for High School Seniors