infer
infer: An R package for tidyverse-friendly statistical inference - Published in JOSS (2021)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in JOSS metadata -
○Academic publication links
-
✓Committers with academic emails
4 of 31 committers (12.9%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords from Contributors
twitter
tidyverse
Last synced: 4 months ago
·
JSON representation
Repository
An R package for tidyverse-friendly statistical inference
Basic Info
- Host: GitHub
- Owner: tidymodels
- License: other
- Language: R
- Default Branch: main
- Homepage: https://infer.tidymodels.org
- Size: 177 MB
Statistics
- Stars: 764
- Watchers: 26
- Forks: 82
- Open Issues: 7
- Releases: 20
Created over 8 years ago
· Last pushed 5 months ago
Metadata Files
Readme
Changelog
Contributing
License
Code of conduct
README.Rmd
--- output: github_document --- # infer R Package[](https://github.com/tidymodels/infer/actions/workflows/R-CMD-check.yaml) [](https://cran.r-project.org/package=infer) [](https://app.codecov.io/gh/tidymodels/infer) The objective of this package is to perform statistical inference using an expressive statistical grammar that coheres with the tidyverse design framework. The package is centered around 4 main verbs, supplemented with many utilities to visualize and extract value from their outputs. + `specify()` allows you to specify the variable, or relationship between variables, that you're interested in. + `hypothesize()` allows you to declare the null hypothesis. + `generate()` allows you to generate data reflecting the null hypothesis. + `calculate()` allows you to calculate a distribution of statistics from the generated data to form the null distribution. To learn more about the principles underlying the package design, see `vignette("infer")`. ```{r load-package, echo = FALSE, message = FALSE, warning = FALSE} library(infer) ``` ```{r diagram, echo = FALSE, fig.cap = " ", fig.alt = "A diagram showing four steps to carry out randomization-based inference: specify hypothesis, generate data, calculate statistic, and visualize. From left to right, each step is connected by an arrow, while the diagram indicates that generating data and calculating statistics can happen iteratively."} knitr::include_graphics("https://raw.githubusercontent.com/tidymodels/infer/main/figs/ht-diagram.png") ``` If you're interested in learning more about randomization-based statistical inference generally, including applied examples of this package, we recommend checking out [Statistical Inference Via Data Science: A ModernDive Into R and the Tidyverse](https://moderndive.com/v2/) and [Introduction to Modern Statistics](https://openintro-ims.netlify.app/). ### Installation ------------------------------------------------------------------------ To install the current stable version of infer from CRAN: ```{r, eval = FALSE} install.packages("infer") ``` To install the developmental stable version of infer, make sure to install remotes first. The pkgdown website for this version is at [infer.tidymodels.org](https://infer.tidymodels.org/). ```{r, eval = FALSE} # install.packages("pak") pak::pak("tidymodels/infer") ``` ### Contributing ------------------------------------------------------------------------ We welcome others helping us make this package as user-friendly and efficient as possible. Please review our [contributing](https://github.com/tidymodels/infer/blob/main/CONTRIBUTING.md) and [conduct](https://github.com/tidymodels/infer/blob/main/.github/CODE_OF_CONDUCT.md) guidelines. By participating in this project you agree to abide by its terms. For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on Posit Community](https://forum.posit.co/new-topic?category_id=15&tags=tidymodels,question). If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/infer/issues). Either way, learn how to create and share a [reprex](https://reprex.tidyverse.org/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/). ### Examples ------------------------------------------------------------------------ These examples are pulled from the "Full infer Pipeline Examples" vignette, accessible by calling `vignette("observed_stat_examples")`. They make use of the `gss` dataset supplied by the package, providing a sample of data from the [General Social Survey](https://gss.norc.org). The data looks like this: ```{r load-gss, warning = FALSE, message = FALSE} # load in the dataset data(gss) # take a glimpse at it str(gss) ``` As an example, we'll run an analysis of variance on `age` and `partyid`, testing whether the age of a respondent is independent of their political party affiliation. Calculating the observed statistic, ```{r, message = FALSE, warning = FALSE} F_hat <- gss |> specify(age ~ partyid) |> calculate(stat = "F") ``` Then, generating the null distribution, ```{r, message = FALSE, warning = FALSE} null_dist <- gss |> specify(age ~ partyid) |> hypothesize(null = "independence") |> generate(reps = 1000, type = "permute") |> calculate(stat = "F") ``` Visualizing the observed statistic alongside the null distribution, ```{r viz, message = FALSE, warning = FALSE, eval = FALSE} visualize(null_dist) + shade_p_value(obs_stat = F_hat, direction = "greater") ``` ```{r viz-graphic, message = FALSE, warning = FALSE, echo = FALSE, fig.cap = " ", fig.alt = "A histogram showing a distribution of F statistics, right-tailed and centered around one. The x axis ranges from zero to five. The region of the histogram to the right of the observed statistic, just above two, is shaded red to represent the p-value."} knitr::include_graphics("https://raw.githubusercontent.com/tidymodels/infer/main/README_files/figure-gfm/viz-1.png") ``` Calculating the p-value from the null distribution and observed statistic, ```{r, message = FALSE, warning = FALSE} null_dist |> get_p_value(obs_stat = F_hat, direction = "greater") ``` Note that the formula and non-formula interfaces (i.e., `age ~ partyid` vs. `response = age, explanatory = partyid`) work for all implemented inference procedures in `infer`. Use whatever is more natural for you. If you will be doing modeling using functions like `lm()` and `glm()`, though, we recommend you begin to use the formula `y ~ x` notation as soon as possible. Other resources are available in the package vignettes! See `vignette("observed_stat_examples")` for more examples like the one above, and `vignette("infer")` for discussion of the underlying principles of the package design.
Owner
- Name: tidymodels
- Login: tidymodels
- Kind: organization
- Repositories: 59
- Profile: https://github.com/tidymodels
JOSS Publication
Papers & Mentions
Total mentions: 7
Dosage Transmission Disequilibrium Test (dTDT) for Linkage and Association Detection
- DOI: 10.1371/journal.pone.0063526
- OpenAlex ID: https://openalex.org/W2017379632
- Published: May 2013
Last synced: 2 months ago
Transcriptomics Indicates Active and Passive Metronidazole Resistance Mechanisms in Three Seminal Giardia Lines
- DOI: 10.3389/fmicb.2017.00398
- OpenAlex ID: https://openalex.org/W2595952830
- Published: March 2017
Last synced: 2 months ago
Inform: Efficient Information-Theoretic Analysis of Collective Behaviors
- DOI: 10.3389/frobt.2018.00060
- OpenAlex ID: https://openalex.org/W2801877080
- Published: June 2018
Last synced: 2 months ago
Activation of skeletal muscle–resident glial cells upon nerve injury
- DOI: 10.1172/jci.insight.143469
- OpenAlex ID: https://openalex.org/W3135516608
- Published: April 2021
Last synced: 2 months ago
TNFRSF11B computational development network construction and analysis between frontal cortex of HIV encephalitis (HIVE) and HIVE-control patients
- DOI: 10.1186/1476-9255-7-50
- OpenAlex ID: https://openalex.org/W2157589872
- Published: September 2010
Last synced: 2 months ago
Improvements in Patient Monitoring in the Intensive Care Unit: Survey Study
- DOI: 10.2196/19091
- OpenAlex ID: https://openalex.org/W3025944672
- Published: June 2020
Last synced: 2 months ago
Benchmarking Triage Capability of Symptom Checkers Against That of Medical Laypersons: Survey Study
- DOI: 10.2196/24475
- OpenAlex ID: https://openalex.org/W3126060205
- Published: March 2021
Last synced: 2 months ago
GitHub Events
Total
- Create event: 5
- Release event: 1
- Issues event: 12
- Watch event: 35
- Delete event: 3
- Issue comment event: 20
- Push event: 19
- Pull request review event: 1
- Pull request event: 8
- Fork event: 3
Last Year
- Create event: 5
- Release event: 1
- Issues event: 12
- Watch event: 35
- Delete event: 3
- Issue comment event: 20
- Push event: 19
- Pull request review event: 1
- Pull request event: 8
- Fork event: 3
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Simon P. Couch | s****h@g****m | 610 |
| ismayc | c****y@g****m | 519 |
| andrewpbray | a****y@g****m | 233 |
| echasnovski | e****i@g****m | 130 |
| Chester Ismay | c****r@d****m | 47 |
| Ben Baumer | b****r@g****m | 19 |
| Albert Y. Kim | a****m@g****m | 15 |
| Richard Cotton | r****s@g****m | 8 |
| Chester Ismay | c****y@d****m | 6 |
| jayleetx | j****e@r****u | 5 |
| mine-cetinkaya-rundel | m****e@s****u | 5 |
| Brian Fannin | c****n@P****m | 4 |
| Nick Solomon | n****0@g****m | 4 |
| Emil Hvitfeldt | e****t@g****m | 2 |
| Hannah Frick | h****h@r****m | 2 |
| jimrothstein | j****n@g****m | 2 |
| Carl Ganz | c****z@g****m | 1 |
| Corinne Riddell | c****l@g****m | 1 |
| Joscelin Rocha Hidalgo | j****a@g****m | 1 |
| Brendan Cullen | b****n@u****u | 1 |
| e.chasnovski | e****i@s****m | 1 |
| Xiaochi | x****u@s****u | 1 |
| Randall Pruim | r****m@g****m | 1 |
| Chester Ismay | e****s@g****m | 1 |
| Julia Silge | j****e@g****m | 1 |
| Neal Fultz | n****z@g****m | 1 |
| Teun van den Brand | 4****d | 1 |
| Tobias Rockel | 6****l | 1 |
| alex hayes | a****s@g****m | 1 |
| topepo | m****n@g****m | 1 |
| and 1 more... | ||
Committer Domains (Top 20 + Academic)
students.mq.edu.au: 1
simcord.com: 1
uoregon.edu: 1
rstudio.com: 1
pirategrunt.com: 1
stat.duke.edu: 1
reed.edu: 1
datarobot.com: 1
datacamp.com: 1
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 90
- Total pull requests: 70
- Average time to close issues: 5 months
- Average time to close pull requests: 11 days
- Total issue authors: 52
- Total pull request authors: 11
- Average comments per issue: 2.91
- Average comments per pull request: 2.16
- Merged pull requests: 65
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 11
- Pull requests: 10
- Average time to close issues: 5 days
- Average time to close pull requests: 1 day
- Issue authors: 8
- Pull request authors: 4
- Average comments per issue: 1.55
- Average comments per pull request: 1.9
- Merged pull requests: 9
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- simonpcouch (22)
- andrewpbray (5)
- VectorPosse (5)
- wmorgan485 (3)
- Yunuuuu (2)
- gdbassett (2)
- ismayc (2)
- kellieotto (2)
- mine-cetinkaya-rundel (2)
- nipnipj (2)
- tavareshugo (1)
- davidhodge931 (1)
- adrie-stclair (1)
- prdm0 (1)
- hfrick (1)
Pull Request Authors
- simonpcouch (70)
- EmilHvitfeldt (3)
- Joscelinrocha (2)
- teunbrand (2)
- liubao210 (1)
- andrewpbray (1)
- wmorgan485 (1)
- hfrick (1)
- juliasilge (1)
- carlganz (1)
Top Labels
Issue Labels
upkeep (7)
bug (4)
enhancement (2)
feature (2)
help wanted (1)
question (1)
better documentation (1)
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- cran 27,548 last-month
- Total docker downloads: 33,517,570
-
Total dependent packages: 4
(may contain duplicates) -
Total dependent repositories: 39
(may contain duplicates) - Total versions: 51
- Total maintainers: 1
proxy.golang.org: github.com/tidymodels/infer
- Documentation: https://pkg.go.dev/github.com/tidymodels/infer#section-documentation
- License: other
-
Latest release: v1.0.9
published 6 months ago
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced:
4 months ago
cran.r-project.org: infer
Tidy Statistical Inference
- Homepage: https://github.com/tidymodels/infer
- Documentation: http://cran.r-project.org/web/packages/infer/infer.pdf
- License: MIT + file LICENSE
-
Latest release: 1.0.9
published 6 months ago
Rankings
Stargazers count: 0.5%
Forks count: 0.8%
Downloads: 2.5%
Dependent repos count: 4.2%
Average: 6.5%
Dependent packages count: 10.9%
Docker downloads count: 20.3%
Maintainers (1)
Last synced:
4 months ago
conda-forge.org: r-infer
- Homepage: https://github.com/tidymodels/infer
- License: MIT
-
Latest release: 1.0.3
published over 3 years ago
Rankings
Stargazers count: 15.4%
Forks count: 20.8%
Average: 22.4%
Dependent repos count: 24.4%
Dependent packages count: 29.0%
Last synced:
4 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.5.0 depends
- broom * imports
- dplyr >= 0.7.0 imports
- generics * imports
- ggplot2 * imports
- glue >= 1.3.0 imports
- grDevices * imports
- magrittr * imports
- methods * imports
- patchwork * imports
- purrr * imports
- rlang >= 0.2.0 imports
- tibble * imports
- tidyr * imports
- covr * suggests
- devtools >= 1.12.0 suggests
- fs * suggests
- knitr * suggests
- nycflights13 * suggests
- parsnip * suggests
- rmarkdown * suggests
- stringr * suggests
- testthat * suggests
- vdiffr >= 1.0.0 suggests
.github/workflows/check-hard.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/check-standard.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/lock.yaml
actions
- dessant/lock-threads v2 composite
.github/workflows/pkgdown.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
[](https://github.com/tidymodels/infer/actions/workflows/R-CMD-check.yaml)
[](https://cran.r-project.org/package=infer)
[](https://app.codecov.io/gh/tidymodels/infer)
The objective of this package is to perform statistical inference using an expressive statistical grammar that coheres with the tidyverse design framework. The package is centered around 4 main verbs, supplemented with many utilities to visualize and extract value from their outputs.
+ `specify()` allows you to specify the variable, or relationship between variables, that you're interested in.
+ `hypothesize()` allows you to declare the null hypothesis.
+ `generate()` allows you to generate data reflecting the null hypothesis.
+ `calculate()` allows you to calculate a distribution of statistics from the generated data to form the null distribution.
To learn more about the principles underlying the package design, see `vignette("infer")`.
```{r load-package, echo = FALSE, message = FALSE, warning = FALSE}
library(infer)
```
```{r diagram, echo = FALSE, fig.cap = " ", fig.alt = "A diagram showing four steps to carry out randomization-based inference: specify hypothesis, generate data, calculate statistic, and visualize. From left to right, each step is connected by an arrow, while the diagram indicates that generating data and calculating statistics can happen iteratively."}
knitr::include_graphics("https://raw.githubusercontent.com/tidymodels/infer/main/figs/ht-diagram.png")
```
If you're interested in learning more about randomization-based statistical inference generally, including applied examples of this package, we recommend checking out [Statistical Inference Via Data Science: A ModernDive Into R and the Tidyverse](https://moderndive.com/v2/) and [Introduction to Modern Statistics](https://openintro-ims.netlify.app/).
### Installation
------------------------------------------------------------------------
To install the current stable version of infer from CRAN:
```{r, eval = FALSE}
install.packages("infer")
```
To install the developmental stable version of infer, make sure to install remotes first. The pkgdown website for this version is at [infer.tidymodels.org](https://infer.tidymodels.org/).
```{r, eval = FALSE}
# install.packages("pak")
pak::pak("tidymodels/infer")
```
### Contributing
------------------------------------------------------------------------
We welcome others helping us make this package as user-friendly and efficient as possible. Please review our [contributing](https://github.com/tidymodels/infer/blob/main/CONTRIBUTING.md) and [conduct](https://github.com/tidymodels/infer/blob/main/.github/CODE_OF_CONDUCT.md) guidelines. By participating in this project you agree to abide by its terms.
For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on Posit Community](https://forum.posit.co/new-topic?category_id=15&tags=tidymodels,question). If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/infer/issues). Either way, learn how to create and share a [reprex](https://reprex.tidyverse.org/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/).
### Examples
------------------------------------------------------------------------
These examples are pulled from the "Full infer Pipeline Examples" vignette, accessible by calling `vignette("observed_stat_examples")`. They make use of the `gss` dataset supplied by the package, providing a sample of data from the [General Social Survey](https://gss.norc.org). The data looks like this:
```{r load-gss, warning = FALSE, message = FALSE}
# load in the dataset
data(gss)
# take a glimpse at it
str(gss)
```
As an example, we'll run an analysis of variance on `age` and `partyid`, testing whether the age of a respondent is independent of their political party affiliation.
Calculating the observed statistic,
```{r, message = FALSE, warning = FALSE}
F_hat <- gss |>
specify(age ~ partyid) |>
calculate(stat = "F")
```
Then, generating the null distribution,
```{r, message = FALSE, warning = FALSE}
null_dist <- gss |>
specify(age ~ partyid) |>
hypothesize(null = "independence") |>
generate(reps = 1000, type = "permute") |>
calculate(stat = "F")
```
Visualizing the observed statistic alongside the null distribution,
```{r viz, message = FALSE, warning = FALSE, eval = FALSE}
visualize(null_dist) +
shade_p_value(obs_stat = F_hat, direction = "greater")
```
```{r viz-graphic, message = FALSE, warning = FALSE, echo = FALSE, fig.cap = " ", fig.alt = "A histogram showing a distribution of F statistics, right-tailed and centered around one. The x axis ranges from zero to five. The region of the histogram to the right of the observed statistic, just above two, is shaded red to represent the p-value."}
knitr::include_graphics("https://raw.githubusercontent.com/tidymodels/infer/main/README_files/figure-gfm/viz-1.png")
```
Calculating the p-value from the null distribution and observed statistic,
```{r, message = FALSE, warning = FALSE}
null_dist |>
get_p_value(obs_stat = F_hat, direction = "greater")
```
Note that the formula and non-formula interfaces (i.e., `age ~ partyid` vs. `response = age, explanatory = partyid`) work for all implemented inference procedures in `infer`. Use whatever is more natural for you. If you will be doing modeling using functions like `lm()` and `glm()`, though, we recommend you begin to use the formula `y ~ x` notation as soon as possible.
Other resources are available in the package vignettes! See `vignette("observed_stat_examples")` for more examples like the one above, and `vignette("infer")` for discussion of the underlying principles of the package design.
