-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.Rmd
91 lines (62 loc) · 3.21 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# poissonreg <a href="https://poissonreg.tidymodels.org/"><img src="man/figures/logo.png" align="right" height="138" alt="Six fishes, each in a different color: red, green, orange, purple, yellow, blue." /></a>
<!-- badges: start -->
[![R-CMD-check](https://github.com/tidymodels/poissonreg/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidymodels/poissonreg/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/poissonreg)](https://CRAN.R-project.org/package=poissonreg)
[![Codecov test coverage](https://codecov.io/gh/tidymodels/poissonreg/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidymodels/poissonreg?branch=main)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)
<!-- badges: end -->
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/).