{"id":13665904,"url":"https://github.com/tidymodels/infer","last_synced_at":"2025-05-14T12:11:36.517Z","repository":{"id":21647952,"uuid":"93430707","full_name":"tidymodels/infer","owner":"tidymodels","description":"An R package for tidyverse-friendly statistical inference","archived":false,"fork":false,"pushed_at":"2025-04-09T14:54:22.000Z","size":184846,"stargazers_count":739,"open_issues_count":8,"forks_count":79,"subscribers_count":26,"default_branch":"main","last_synced_at":"2025-04-13T20:18:07.878Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://infer.tidymodels.org","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tidymodels.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-05T17:41:42.000Z","updated_at":"2025-04-13T11:16:03.000Z","dependencies_parsed_at":"2023-01-14T00:30:27.755Z","dependency_job_id":"624089d0-116d-4c11-a56b-4b94ffc214b1","html_url":"https://github.com/tidymodels/infer","commit_stats":{"total_commits":1573,"total_committers":31,"mean_commits":50.74193548387097,"dds":0.6427209154481881,"last_synced_commit":"c610ea01d80c45acdf9e69994402f8412ccf73f4"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidymodels%2Finfer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidymodels%2Finfer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidymodels%2Finfer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidymodels%2Finfer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tidymodels","download_url":"https://codeload.github.com/tidymodels/infer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248774961,"owners_count":21159534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T06:00:53.412Z","updated_at":"2025-04-13T20:18:13.611Z","avatar_url":"https://github.com/tidymodels.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n# infer R Package \u003cimg src=\"man/figures/logo.png\" alt=\"A hexagonal logo. A silhouette of a fir tree sits atop green text, reading 'infer'. The logo has a white background and green border.\" align=\"right\" width=280 /\u003e\n\n\n\n\n\u003c!--figs/infer.svg--\u003e\n\u003c!--http://www.r-pkg.org/badges/version/infer--\u003e\n\u003c!--figs/main.svg--\u003e\n\u003c!--https://img.shields.io/codecov/c/github/tidymodels/infer/main.svg--\u003e\n\n[![R-CMD-check](https://github.com/tidymodels/infer/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/tidymodels/infer/actions/workflows/check-standard.yaml)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/infer)](https://cran.r-project.org/package=infer)\n[![Coverage Status](https://img.shields.io/codecov/c/github/tidymodels/infer/main.svg)](https://app.codecov.io/github/tidymodels/infer/?branch=main)\n\nThe 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.\n\n+ `specify()` allows you to specify the variable, or relationship between variables, that you're interested in.\n+ `hypothesize()` allows you to declare the null hypothesis.\n+ `generate()` allows you to generate data reflecting the null hypothesis.\n+ `calculate()` allows you to calculate a distribution of statistics from the generated data to form the null distribution.\n\nTo learn more about the principles underlying the package design, see `vignette(\"infer\")`.\n\n```{r load-package, echo = FALSE, message = FALSE, warning = FALSE}\nlibrary(infer)\n```\n\n```{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.\"}\nknitr::include_graphics(\"https://raw.githubusercontent.com/tidymodels/infer/main/figs/ht-diagram.png\")\n```\n\nIf 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/) and [Introduction to Modern Statistics](https://openintro-ims.netlify.app/).\n\n### Installation\n\n------------------------------------------------------------------------\n\nTo install the current stable version of infer from CRAN:\n\n```{r, eval = FALSE}\ninstall.packages(\"infer\")\n```\n\nTo 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/).\n\n```{r, eval = FALSE}\n# install.packages(\"pak\")\npak::pak(\"tidymodels/infer\")\n```\n\n### Contributing\n\n------------------------------------------------------------------------\n\nWe 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.\n\nFor questions and discussions about tidymodels packages, modeling, and machine learning, please [post on Posit Community](https://forum.posit.co/new-topic?category_id=15\u0026tags=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/).\n\n### Examples\n\n------------------------------------------------------------------------\n\nThese 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:\n\n```{r load-gss, warning = FALSE, message = FALSE}\n# load in the dataset\ndata(gss)\n\n# take a glimpse at it\nstr(gss)\n```\n\nAs 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.\n\nCalculating the observed statistic,\n\n```{r, message = FALSE, warning = FALSE}\nF_hat \u003c- gss %\u003e% \n  specify(age ~ partyid) %\u003e%\n  calculate(stat = \"F\")\n```\n\nThen, generating the null distribution,\n\n```{r, message = FALSE, warning = FALSE}\nnull_dist \u003c- gss %\u003e%\n   specify(age ~ partyid) %\u003e%\n   hypothesize(null = \"independence\") %\u003e%\n   generate(reps = 1000, type = \"permute\") %\u003e%\n   calculate(stat = \"F\")\n```\n\nVisualizing the observed statistic alongside the null distribution,\n\n```{r viz, message = FALSE, warning = FALSE, eval = FALSE}\nvisualize(null_dist) +\n  shade_p_value(obs_stat = F_hat, direction = \"greater\")\n```\n\n```{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.\"}\nknitr::include_graphics(\"https://raw.githubusercontent.com/tidymodels/infer/main/README_files/figure-gfm/viz-1.png\")\n```\n\nCalculating the p-value from the null distribution and observed statistic,\n\n```{r, message = FALSE, warning = FALSE}\nnull_dist %\u003e%\n  get_p_value(obs_stat = F_hat, direction = \"greater\")\n```\n\n\nNote 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.\n\nOther 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidymodels%2Finfer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftidymodels%2Finfer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidymodels%2Finfer/lists"}