{"id":16471963,"url":"https://github.com/corymccartan/birdie","last_synced_at":"2025-07-17T13:34:39.273Z","repository":{"id":133440437,"uuid":"439740229","full_name":"CoryMcCartan/birdie","owner":"CoryMcCartan","description":"Bayesian Instrumental Regression for Disparity Estimation","archived":false,"fork":false,"pushed_at":"2025-04-14T03:04:14.000Z","size":26687,"stargazers_count":6,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-16T07:47:58.642Z","etag":null,"topics":["imputation","r","racial-disparities","statistics"],"latest_commit_sha":null,"homepage":"http://corymccartan.com/birdie/","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/CoryMcCartan.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"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,"zenodo":null}},"created_at":"2021-12-19T00:07:26.000Z","updated_at":"2025-06-02T00:08:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"4bc2c103-6259-4ecb-8c0d-a277221cc981","html_url":"https://github.com/CoryMcCartan/birdie","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/CoryMcCartan/birdie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoryMcCartan%2Fbirdie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoryMcCartan%2Fbirdie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoryMcCartan%2Fbirdie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoryMcCartan%2Fbirdie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CoryMcCartan","download_url":"https://codeload.github.com/CoryMcCartan/birdie/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoryMcCartan%2Fbirdie/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265611387,"owners_count":23797878,"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":["imputation","r","racial-disparities","statistics"],"created_at":"2024-10-11T12:15:41.532Z","updated_at":"2025-07-17T13:34:39.248Z","avatar_url":"https://github.com/CoryMcCartan.png","language":"R","funding_links":[],"categories":[],"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  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\nset.seed(5118)\n```\n\n# **BIRDiE**: Estimating disparities when race is not observed \u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"156\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/CoryMcCartan/birdie/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/CoryMcCartan/birdie/actions/workflows/R-CMD-check.yaml)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version-last-release/birdie)](https://cran.r-project.org/package=redist)\n![CRAN downloads](http://cranlogs.r-pkg.org/badges/grand-total/birdie)\n\u003c!-- badges: end --\u003e\n\nBayesian Instrumental Regression for Disparity Estimation (BIRDiE) is a class of\nBayesian models for accurately estimating conditional distributions by race, \nusing Bayesian Improved Surname Geocoding (BISG) probability estimates of\nindividual race.\nThis package implements BIRDiE as described in [McCartan, Fisher, Goldin, Ho, and Imai (2024)](https://www.nber.org/papers/w32373).\nIt also implements standard BISG and an improved measurement-error BISG model as described \nin [Imai, Olivella, and Rosenman (2022)](https://www.science.org/doi/full/10.1126/sciadv.adc9824).\n\n\u003cimg src=\"man/figures/poster.svg\" style=\"width: 100%\" alt=\"BIRDiE Overview Poster\" /\u003e\n\n## Installation\n\nYou can install the latest version of the package from CRAN with:\n\n``` r\ninstall.packages(\"birdie\")\n```\n\nYou can also install the development version with:\n\n``` r\n# install.packages(\"remotes\")\nremotes::install_github(\"CoryMcCartan/birdie\")\n```\n\n## Basic Usage\n\nA basic analysis has two steps.\nFirst, you compute BISG probability estimates with the `bisg()` or `bisg_me()` functions (or using any other probabilistic race prediction tool).\nThen, you estimate the distribution of an outcome variable by race using the `birdie()` function.\n\n```{r}\nlibrary(birdie)\n\ndata(pseudo_vf)\n\nhead(pseudo_vf)\n```\n\nTo compute BISG probabilities, you provide the last name and (optionally) geography variables as part of a formula.\n\n```{r}\nr_probs = bisg(~ nm(last_name) + zip(zip), data=pseudo_vf)\n\nhead(r_probs)\n```\n\nComputing regression estimates requires specifying a model structure.\nHere, we'll use a Categorical-Dirichlet regression model that lets the\nrelationship between turnout and race vary by ZIP code.\nThis is the \"no-pooling\" model from McCartan et al.\nWe'll use Gibbs sampling for inference, which will also let us capture the uncertainty in our estimates.\n\n```{r}\nfit = birdie(r_probs, turnout ~ proc_zip(zip), data=pseudo_vf, \n             family=cat_dir(), algorithm=\"gibbs\")\n\nprint(fit)\n```\n\nThe `proc_zip()` function fills in missing ZIP codes, among other things.\nWe can extract the estimated conditional distributions with `coef()`.\nWe can also get updated BISG probabilities that additionally condition on turnout using `fitted()`.\nAdditional functions allow us to extract a tidy version of our estimates (`tidy()`)\nand visualize the estimated distributions (`plot()`).\n\n```{r}\ncoef(fit)\n\nhead(fitted(fit))\n\ntidy(fit)\n\nplot(fit)\n```\n\nA more detailed introduction to the method and software package can be found \non the [Get Started](https://corymccartan.com/birdie/articles/birdie.html) page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorymccartan%2Fbirdie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorymccartan%2Fbirdie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorymccartan%2Fbirdie/lists"}