{"id":14068646,"url":"https://github.com/IndrajeetPatil/broomExtra","last_synced_at":"2025-07-30T04:31:45.533Z","repository":{"id":34296969,"uuid":"172177266","full_name":"IndrajeetPatil/broomExtra","owner":"IndrajeetPatil","description":"Helpers for regression analyses using `{broom}` \u0026 `{easystats}` packages  📈 🔍","archived":true,"fork":false,"pushed_at":"2022-10-10T06:37:44.000Z","size":14481,"stargazers_count":48,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-13T07:15:09.285Z","etag":null,"topics":["broom","easystats","performance-measures","regression","regression-analyses","regression-models","tidy","tidy-tibbles"],"latest_commit_sha":null,"homepage":"https://indrajeetpatil.github.io/broomExtra/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IndrajeetPatil.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS.txt","security":null,"support":null}},"created_at":"2019-02-23T05:53:21.000Z","updated_at":"2024-08-07T20:42:15.000Z","dependencies_parsed_at":"2022-08-08T00:15:41.801Z","dependency_job_id":null,"html_url":"https://github.com/IndrajeetPatil/broomExtra","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IndrajeetPatil%2FbroomExtra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IndrajeetPatil%2FbroomExtra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IndrajeetPatil%2FbroomExtra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IndrajeetPatil%2FbroomExtra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IndrajeetPatil","download_url":"https://codeload.github.com/IndrajeetPatil/broomExtra/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228082350,"owners_count":17866606,"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":["broom","easystats","performance-measures","regression","regression-analyses","regression-models","tidy","tidy-tibbles"],"created_at":"2024-08-13T07:06:19.434Z","updated_at":"2024-12-04T09:31:12.238Z","avatar_url":"https://github.com/IndrajeetPatil.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\"\n)\n```\n\n## `{broomExtra}`: Enhancement for `{broom}` and `{easystats}` \n\n[![lifecycle](https://img.shields.io/badge/lifecycle-deprecated-red.svg)](https://lifecycle.r-lib.org/articles/stages.html#deprecated)\n\n\u003cimg src=\"man/figures/logo.png\" align=\"right\" width=\"240\" /\u003e\n\n\u003c!-- The goal of `{broomExtra}` is to provide helper functions that assist in data --\u003e\n\u003c!-- analysis workflows involving regression analyses. The goal is to combine the --\u003e\n\u003c!-- functionality offered by different set of packages through a common syntax to --\u003e\n\u003c!-- return tidy tibbles containing model parameters and summaries. --\u003e\n\n\u003c!-- It combines functionality from `{broom}` and `{easystats}` ecosystems, and this package has the --\u003e\n\u003c!-- following advantages over the underlying individual packages (see examples --\u003e\n\u003c!-- below for concrete instantiations of these benefits): --\u003e\n\n\u003c!--   - Covers more number of regression models than these individual packages. --\u003e\n\u003c!--   - If possible to compute, the output tibbles contains a *p*-value column. --\u003e\n\u003c!--   - More robust to extraneous input arguments that might sometimes cause --\u003e\n\u003c!--     problems for the underlying methods. --\u003e\n\u003c!--   - Follows consistent `{tidymodels}` column-naming schema. --\u003e\n\u003c!--   - Returns a more comprehensive model performance measure summary. --\u003e\n\n\u003c!-- If you want to add support for a regression model, the natural place to do this --\u003e\n\u003c!-- would be to contribute either to `{broom}` or to `{parameters}`. --\u003e\n\nThis package has been archived on CRAN. Additionally, it is deprecated in favour of the [easystats](https://easystats.github.io/easystats/) project. \n\nThe package can still be downloaded from GitHub:\n`pak::pak(\"IndrajeetPatil/broomExtra\")`\n\n\u003c!-- ## Lifecycle --\u003e\n\n\u003c!-- Function | Lifecycle --\u003e\n\u003c!-- ------------------------ | -----  --\u003e\n\u003c!-- `tidy_parameters` | [![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html) --\u003e\n\u003c!-- `glance_performance` | [![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html) --\u003e\n\u003c!-- `tidy`, `glance`, `augment` | [![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html) --\u003e\n\u003c!-- `grouped_tidy`, `grouped_glance`, `grouped_augment` | [![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html) --\u003e\n\n\u003c!-- ## Hybrid generics --\u003e\n\n\u003c!-- The `{broom}`-family of packages are not the only ones which return such tidy --\u003e\n\u003c!-- summaries for model parameters and model performance. The `{easystats}`-family of --\u003e\n\u003c!-- packages also provide similar functions, more specifically --\u003e\n\u003c!-- [parameters](https://easystats.github.io/parameters/) and --\u003e\n\u003c!-- [performance](https://easystats.github.io/performance/). Sometimes the `{broom}` --\u003e\n\u003c!-- packages might not contain a `tidy`/`glance` method for a given regression --\u003e\n\u003c!-- object, while `{easystats}` packages would and *vice versa*.  --\u003e\n\n\u003c!-- The hybrid functions in `{broomExtra}` make it easy to retrieve these summaries --\u003e\n\u003c!-- with the appropriate method and do so robustly: --\u003e\n\n\u003c!--   - `broom::tidy` + `parameters::model_parameters` = --\u003e\n\u003c!--     `broomExtra::tidy_parameters` --\u003e\n\n\u003c!--   - `broom::glance` + `performance::model_performance` = --\u003e\n\u003c!--     `broomExtra::glance_performance` --\u003e\n\n\u003c!-- Benefits of using hybrid generics --\u003e\n\n\u003c!-- - The `tidy_parameters` will return a model summary either from `broomExtra::tidy` --\u003e\n\u003c!-- or `parameters::model_parameters`, so you get best of the both worlds. --\u003e\n\n\n\u003c!-- - These functions are robust such that they won't fail if the `...` contains --\u003e\n\u003c!-- misspecified arguments. This makes these functions much easier to work with while writing wrapper --\u003e\n\u003c!-- functions around `broomExtra::tidy` or `parameters::model_parameters`. --\u003e\n\n\u003c!-- ## Generic functions --\u003e\n\n\u003c!-- Currently, `S3` methods for mixed-effects model objects are included in the --\u003e\n\u003c!-- `{broom.mixed}` package, while the rest of the object classes are included in the --\u003e\n\u003c!-- `{broom}` package. This means that you constantly need to keep track of the class --\u003e\n\u003c!-- of the object (e.g., \"if it is `merMod` object, use --\u003e\n\u003c!-- `broom.mixed::tidy()`/`broom.mixed::glance()`/`broom.mixed::augment()`, but if --\u003e\n\u003c!-- it is `polr` object, use `broom::tidy()`/`broom::glance()`/`broom::augment()`\"). --\u003e\n\n\u003c!-- Using generics from `{broomExtra}` means you no longer have to worry about this, --\u003e\n\u003c!-- as calling `broomExtra::tidy()`/`broomExtra::glance()`/`broomExtra::augment()` --\u003e\n\u003c!-- will search the appropriate method from these two packages and return the --\u003e\n\u003c!-- results. --\u003e\n\n\u003c!-- #### tidy dataframe --\u003e\n\n\u003c!-- Let's get a tidy tibble back containing results from various regression models. --\u003e\n\n\u003c!-- ```{r tidy, error = TRUE} --\u003e\n\u003c!-- set.seed(123) --\u003e\n\u003c!-- library(lme4) --\u003e\n\u003c!-- library(ordinal) --\u003e\n\u003c!-- library(broomExtra) --\u003e\n\u003c!-- library(dplyr) --\u003e\n\n\u003c!-- ## mixed-effects models (`{broom.mixed}` will be used) --\u003e\n\u003c!-- lmm.mod \u003c- lmer(Reaction ~ Days + (Days | Subject), sleepstudy) --\u003e\n\u003c!-- broomExtra::tidy(x = lmm.mod, effects = \"fixed\") --\u003e\n\n\u003c!-- ## linear model (`{broom}` will be used) --\u003e\n\u003c!-- lm.mod \u003c- lm(Reaction ~ Days, sleepstudy) --\u003e\n\u003c!-- broomExtra::tidy(lm.mod, conf.int = TRUE) --\u003e\n\n\u003c!-- ## another example with `{broom}` --\u003e\n\u003c!-- ## cumulative Link Models --\u003e\n\u003c!-- clm.mod \u003c- clm(rating ~ temp * contact, data = wine) --\u003e\n\u003c!-- broomExtra::tidy(x = clm.mod, exponentiate = TRUE) --\u003e\n\n\u003c!-- ## unsupported object (the function will return `NULL` in such cases) --\u003e\n\u003c!-- broomExtra::tidy(list(1, c(\"x\", \"y\"))) --\u003e\n\u003c!-- ``` --\u003e\n\n\u003c!-- #### model summaries --\u003e\n\n\u003c!-- Getting a `tibble` containing model summary and other performance measures. --\u003e\n\n\u003c!-- ```{r glance, error = TRUE} --\u003e\n\u003c!-- set.seed(123) --\u003e\n\u003c!-- library(lme4) --\u003e\n\u003c!-- library(ordinal) --\u003e\n\n\u003c!-- ## mixed-effects model --\u003e\n\u003c!-- lmm.mod \u003c- lmer(Reaction ~ Days + (Days | Subject), sleepstudy) --\u003e\n\u003c!-- broomExtra::glance(lmm.mod) --\u003e\n\n\u003c!-- ## linear model --\u003e\n\u003c!-- lm.mod \u003c- lm(Reaction ~ Days, sleepstudy) --\u003e\n\u003c!-- broomExtra::glance(lm.mod) --\u003e\n\n\u003c!-- ## another example with `{broom}` --\u003e\n\u003c!-- ## cumulative Link Models --\u003e\n\u003c!-- clm.mod \u003c- clm(rating ~ temp * contact, data = wine) --\u003e\n\u003c!-- broomExtra::glance(clm.mod) --\u003e\n\n\u003c!-- ## in case no glance method is available (`NULL` will be returned) --\u003e\n\u003c!-- broomExtra::glance(acf(lh, plot = FALSE)) --\u003e\n\u003c!-- ``` --\u003e\n\n\u003c!-- #### augmented dataframe --\u003e\n\n\u003c!-- Getting a `tibble` by augmenting data with information from an object. --\u003e\n\n\u003c!-- ```{r augment, error = TRUE} --\u003e\n\u003c!-- set.seed(123) --\u003e\n\u003c!-- library(lme4) --\u003e\n\u003c!-- library(ordinal) --\u003e\n\n\u003c!-- ## mixed-effects model --\u003e\n\u003c!-- lmm.mod \u003c- lmer(Reaction ~ Days + (Days | Subject), sleepstudy) --\u003e\n\u003c!-- broomExtra::augment(lmm.mod) --\u003e\n\n\u003c!-- ## linear model --\u003e\n\u003c!-- lm.mod \u003c- lm(Reaction ~ Days, sleepstudy) --\u003e\n\u003c!-- broomExtra::augment(lm.mod) --\u003e\n\n\u003c!-- ## another example with `{broom}` --\u003e\n\u003c!-- ## cumulative Link Models --\u003e\n\u003c!-- clm.mod \u003c- clm(rating ~ temp * contact, data = wine) --\u003e\n\u003c!-- broomExtra::augment(x = clm.mod, newdata = wine, type.predict = \"prob\") --\u003e\n\n\u003c!-- ## in case no augment method is available (`NULL` will be returned) --\u003e\n\u003c!-- broomExtra::augment(stats::anova(stats::lm(wt ~ am, mtcars))) --\u003e\n\u003c!-- ``` --\u003e\n\n\u003c!-- ## `grouped_` variants of generics --\u003e\n\n\u003c!-- `grouped` variants of the generic functions (`tidy`, `glance`, and `augment`) --\u003e\n\u003c!-- make it easy to execute the same analysis for all combinations of grouping --\u003e\n\u003c!-- variable(s) in a dataframe. Currently, these functions work only for methods --\u003e\n\u003c!-- that depend on a `data` argument (e.g., `stats::lm`), but not for functions that --\u003e\n\u003c!-- don't (e.g., `stats::prop.test()`). --\u003e\n\n\u003c!-- #### `grouped_tidy` --\u003e\n\n\u003c!-- ```{r grouped_tidy} --\u003e\n\u003c!-- ## to speed up computation, let's use only 50% of the data --\u003e\n\u003c!-- set.seed(123) --\u003e\n\u003c!-- library(lme4) --\u003e\n\u003c!-- library(ggplot2) --\u003e\n\u003c!-- library(broomExtra) --\u003e\n\n\u003c!-- ## linear model (tidy analysis across grouping combinations) --\u003e\n\u003c!-- grouped_tidy( --\u003e\n\u003c!--   data = sample_frac(ggplot2::diamonds, size = 0.5), --\u003e\n\u003c!--   grouping.vars = c(cut, color), --\u003e\n\u003c!--   formula = price ~ carat - 1, --\u003e\n\u003c!--   ..f = stats::lm, --\u003e\n\u003c!--   na.action = na.omit, --\u003e\n\u003c!--   tidy.args = list(quick = TRUE) --\u003e\n\u003c!-- ) --\u003e\n\n\u003c!-- ## linear mixed effects model (tidy analysis across grouping combinations) --\u003e\n\u003c!-- grouped_tidy( --\u003e\n\u003c!--   data = sample_frac(ggplot2::diamonds, size = 0.5), --\u003e\n\u003c!--   grouping.vars = cut, --\u003e\n\u003c!--   ..f = lme4::lmer, --\u003e\n\u003c!--   formula = price ~ carat + (carat | color) - 1, --\u003e\n\u003c!--   control = lme4::lmerControl(optimizer = \"bobyqa\"), --\u003e\n\u003c!--   tidy.args = list(conf.int = TRUE, conf.level = 0.99) --\u003e\n\u003c!-- ) --\u003e\n\u003c!-- ``` --\u003e\n\n\u003c!-- #### `grouped_glance` --\u003e\n\n\u003c!-- ```{r grouped_glance} --\u003e\n\u003c!-- ## to speed up computation, let's use only 50% of the data --\u003e\n\u003c!-- set.seed(123) --\u003e\n\n\u003c!-- ## linear model (model summaries across grouping combinations) --\u003e\n\u003c!-- grouped_glance( --\u003e\n\u003c!--   data = sample_frac(ggplot2::diamonds, size = 0.5), --\u003e\n\u003c!--   grouping.vars = c(cut, color), --\u003e\n\u003c!--   formula = price ~ carat - 1, --\u003e\n\u003c!--   ..f = stats::lm, --\u003e\n\u003c!--   na.action = na.omit --\u003e\n\u003c!-- ) --\u003e\n\n\u003c!-- ## linear mixed effects model (model summaries across grouping combinations) --\u003e\n\u003c!-- grouped_glance( --\u003e\n\u003c!--   data = sample_frac(ggplot2::diamonds, size = 0.5), --\u003e\n\u003c!--   grouping.vars = cut, --\u003e\n\u003c!--   ..f = lme4::lmer, --\u003e\n\u003c!--   formula = price ~ carat + (carat | color) - 1, --\u003e\n\u003c!--   control = lme4::lmerControl(optimizer = \"bobyqa\") --\u003e\n\u003c!-- ) --\u003e\n\u003c!-- ``` --\u003e\n\n\u003c!-- #### `grouped_augment` --\u003e\n\n\u003c!-- ```{r grouped_augment} --\u003e\n\u003c!-- ## to speed up computation, let's use only 50% of the data --\u003e\n\u003c!-- set.seed(123) --\u003e\n\n\u003c!-- ## linear model --\u003e\n\u003c!-- grouped_augment( --\u003e\n\u003c!--   data = ggplot2::diamonds, --\u003e\n\u003c!--   grouping.vars = c(cut, color), --\u003e\n\u003c!--   ..f = stats::lm, --\u003e\n\u003c!--   formula = price ~ carat - 1 --\u003e\n\u003c!-- ) --\u003e\n\n\u003c!-- ## linear mixed-effects model --\u003e\n\u003c!-- grouped_augment( --\u003e\n\u003c!--   data = sample_frac(ggplot2::diamonds, size = 0.5), --\u003e\n\u003c!--   grouping.vars = cut, --\u003e\n\u003c!--   ..f = lme4::lmer, --\u003e\n\u003c!--   formula = price ~ carat + (carat | color) - 1, --\u003e\n\u003c!--   control = lme4::lmerControl(optimizer = \"bobyqa\") --\u003e\n\u003c!-- ) --\u003e\n\u003c!-- ``` --\u003e\n\n## Acknowledgments\n\nThe hexsticker was generously designed by Sarah Otterstetter (Max Planck\nInstitute for Human Development, Berlin). Thanks are also due to the maintainers\nand contributors to `{broom}`- and `{easystats}`-package families who have indulged\nin all my feature requests!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIndrajeetPatil%2FbroomExtra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIndrajeetPatil%2FbroomExtra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIndrajeetPatil%2FbroomExtra/lists"}