https://github.com/tidymodels/poissonreg
parsnip wrappers for Poisson regression
https://github.com/tidymodels/poissonreg
Last synced: 3 months ago
JSON representation
parsnip wrappers for Poisson regression
- Host: GitHub
- URL: https://github.com/tidymodels/poissonreg
- Owner: tidymodels
- License: other
- Created: 2020-03-26T01:32:44.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-11-13T17:54:40.000Z (8 months ago)
- Last Synced: 2025-04-19T03:57:29.868Z (3 months ago)
- Language: R
- Homepage: https://poissonreg.tidymodels.org
- Size: 8.17 MB
- Stars: 22
- Watchers: 5
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Support: .github/SUPPORT.md
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```[](https://github.com/tidymodels/poissonreg/actions/workflows/R-CMD-check.yaml)
[](https://CRAN.R-project.org/package=poissonreg)
[](https://app.codecov.io/gh/tidymodels/poissonreg?branch=main)
[](https://lifecycle.r-lib.org/articles/stages.html)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](https://CRAN.R-project.org) with:
``` r
install.packages("poissonreg")
```Install the development version from GitHub with:
``` r
# install.packages("pak")
pak::pak("tidymodels/poissonreg")
```## Available Engines
The poissonreg package provides engines for the models in the following table.
```{r, echo=FALSE, message=FALSE}
library(parsnip)parsnip_models <- get_from_env("models") %>%
setNames(., .) %>%
purrr::map_dfr(get_from_env, .id = "model")library(poissonreg)
poissonreg_models <- get_from_env("models") %>%
setNames(., .) %>%
purrr::map_dfr(get_from_env, .id = "model")dplyr::anti_join(
poissonreg_models, parsnip_models,
by = c("model", "engine", "mode")
) %>%
knitr::kable()
```## Example
A log-linear model for categorical data analysis:
```{r example}
library(poissonreg)# 3D contingency table from Agresti (2007):
poisson_reg() %>%
set_engine("glm") %>%
fit(count ~ (.)^2, data = seniors)
```## Contributing
This project is released with a [Contributor Code of Conduct](https://www.contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
- For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on RStudio Community](https://community.rstudio.com/new-topic?category_id=15&tags=tidymodels,question).
- If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/poissonreg/issues).
- Either way, learn how to create and share a [reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html) (a minimal, reproducible example), to clearly communicate about your code.
- Check out further details on [contributing guidelines for tidymodels packages](https://www.tidymodels.org/contribute/) and [how to get help](https://www.tidymodels.org/help/).