{"id":50236657,"url":"https://github.com/acarril/wsga","last_synced_at":"2026-05-26T20:01:08.728Z","repository":{"id":94661694,"uuid":"97133274","full_name":"acarril/wsga","owner":"acarril","description":"R and Stata package for weighted subgroup analysis in regression discontinuity and difference-in-differences designs via inverse probability weighting.","archived":false,"fork":false,"pushed_at":"2026-05-25T18:59:11.000Z","size":2491,"stargazers_count":7,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-25T20:33:43.920Z","etag":null,"topics":["causal-inference","difference-in-differences","econometrics","regression-discontinuity-designs","subgroup-analysis"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/acarril.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-07-13T14:41:55.000Z","updated_at":"2026-05-25T18:59:08.000Z","dependencies_parsed_at":"2023-04-04T06:04:20.265Z","dependency_job_id":null,"html_url":"https://github.com/acarril/wsga","commit_stats":null,"previous_names":["acarril/wsga"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/acarril/wsga","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acarril%2Fwsga","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acarril%2Fwsga/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acarril%2Fwsga/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acarril%2Fwsga/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acarril","download_url":"https://codeload.github.com/acarril/wsga/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acarril%2Fwsga/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33536659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["causal-inference","difference-in-differences","econometrics","regression-discontinuity-designs","subgroup-analysis"],"created_at":"2026-05-26T20:00:33.086Z","updated_at":"2026-05-26T20:01:08.711Z","avatar_url":"https://github.com/acarril.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `wsga` — Weighted Subgroup Analysis\n\nImplements inverse probability weighted (IPW) subgroup analysis for research designs that require control variables for identification. When subgroups differ in observed moderators, a naive comparison of subgroup-specific treatment effects conflates the causal effect of the subgroup characteristic with the effect of correlated moderators. Reweighting observations via IPW balances observed moderators across subgroups, isolating the subgroup-attributable component of the treatment effect difference.\n\nBoth a **Stata** package and an **R** package are included in this repository. Both implement weighted subgroup analysis for **regression discontinuity (RD)** designs (sharp and fuzzy) and **sharp 2-period difference-in-differences (DiD)**.\n\n---\n\n## Stata\n\n### Installation\n\nLatest version from this repository:\n```stata\nnet from https://raw.githubusercontent.com/acarril/wsga/main/stata/\nnet install wsga\nnet get wsga\n```\n\n### Quick start (RD)\n\n```stata\nuse rddsga_synth\nwsga rdd y m, sgroup(sgroup) running(x) bwidth(0.5) bsreps(200) seed(42)\n```\n\n### Quick start (DiD)\n\n```stata\nuse wsga_did_synth\nwsga did y m, sgroup(sgroup) unit(unit) time(time) treat(D) bsreps(200) seed(42)\n```\n\nSee `help wsga`, `help wsga rdd`, and `help wsga did` for full documentation. The previous command name `rddsga` is retained as a deprecated alias and is installed alongside `wsga`.\n\n---\n\n## R\n\n### Installation\n\n```r\ndevtools::install_github(\"acarril/wsga\")\n```\n\n### Quick start (RD)\n\n```r\nlibrary(wsga)\ndata(rddsga_synth)\n\nfit \u003c- wsga_rdd(\n  y ~ m | sgroup,\n  data    = rddsga_synth,\n  running = ~ x,\n  bwidth  = 0.5,\n  bsreps  = 200,\n  seed    = 42\n)\nprint(fit)\nsummary(fit)   # also shows balance tables\n```\n\n### Quick start (DiD)\n\n```r\nlibrary(wsga)\ndata(wsga_did_synth)\n\nfit \u003c- wsga_did(\n  y ~ m | sgroup,\n  data   = wsga_did_synth,\n  unit   = \"unit\",\n  time   = \"time\",\n  treat  = \"D\",\n  bsreps = 200,\n  seed   = 42\n)\nprint(fit)\nsummary(fit)   # shows aggregate and treated-only balance tables\n```\n\nSee `?wsga_rdd`, `?wsga_did`, `vignette(\"wsga-intro\")`, and `vignette(\"wsga-did-intro\")` for full documentation. The previous function name `rddsga()` is retained as a deprecated alias.\n\n---\n\n## Reference\n\nCarril, Alvaro, Andre Cazor, Maria Paula Gerardino, Stephan Litschig, and Dina Pomeranz. \"Weighted Subgroup Analysis\". Working paper.\n\n## Issues\n\nPlease report bugs at \u003chttps://github.com/acarril/wsga/issues\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facarril%2Fwsga","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facarril%2Fwsga","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facarril%2Fwsga/lists"}