{"id":24432196,"url":"https://github.com/bayer-group/pybalance","last_synced_at":"2025-10-06T02:18:34.159Z","repository":{"id":198115572,"uuid":"682076902","full_name":"Bayer-Group/pybalance","owner":"Bayer-Group","description":"A library for minimizing the effects of confounding covariates","archived":false,"fork":false,"pushed_at":"2025-05-28T09:56:03.000Z","size":34822,"stargazers_count":15,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-09T14:01:36.266Z","etag":null,"topics":["beat-undefined","confounding","machine-learning","python","statistical-analysis"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bayer-Group.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","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":"2023-08-23T11:43:27.000Z","updated_at":"2025-09-03T05:52:29.000Z","dependencies_parsed_at":"2024-01-18T09:33:32.893Z","dependency_job_id":"67be5fd5-5a35-4203-8ca6-e8da49619b8e","html_url":"https://github.com/Bayer-Group/pybalance","commit_stats":null,"previous_names":["bayer-group/pybalance"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/Bayer-Group/pybalance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bayer-Group%2Fpybalance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bayer-Group%2Fpybalance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bayer-Group%2Fpybalance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bayer-Group%2Fpybalance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bayer-Group","download_url":"https://codeload.github.com/Bayer-Group/pybalance/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bayer-Group%2Fpybalance/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278547908,"owners_count":26004793,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["beat-undefined","confounding","machine-learning","python","statistical-analysis"],"created_at":"2025-01-20T15:35:32.141Z","updated_at":"2025-10-06T02:18:34.141Z","avatar_url":"https://github.com/Bayer-Group.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"![https://bayer-group.github.io/pybalance/index.html](logo.png)\n\n## Confounding Adjustment\n\nIn scientific experiments, researchers aim to identify cause and effect by\nholding all variables except one constant. Any difference in outcome can then\nbe attributed to the manipulated variable.\n\nHowever, in many practical cases, it is not possible to control the variables\nof interest. For instance, it is unethical to conduct a randomized trial to test\nthe effects of smoking on long-term health outcomes; yet the answer to this\nquestion is of extreme interest to policy makers, insurance companies and\nregulatory agencies. Similarly, in social science research, when studying the\nimpact of education on income, researchers cannot manipulate individuals' education\nlevels while holding all other variables constant.\n\nIn these cases, observational data can form the basis for \"natural experiments\" but\ncare must be taken in interpreting these data. One major issue with interpreting these\ndata is known as \"confounding\".\n\nA classic example of confounding is the association between coffee consumption and\nheart disease. Initially, a study might find a positive correlation between high\ncoffee consumption and increased risk of heart disease. However, this apparent\nrelationship could be confounded by the fact that heavy coffee drinkers are more\nlikely to also smoke, which is a known risk factor for heart disease. In this case,\nsmoking acts as a confounding variable, as it distorts the true relationship between\ncoffee consumption and heart disease. To address this, researchers need to adjust for\nsmoking status and potentially other relevant variables to accurately assess the\nindependent impact of coffee consumption on heart disease risk.\n\nIn general, any comparative analysis of two non-randomized populations will differ\nsystematically in a number of covariate dimensions and these systematic differences\nmust be adjusted for as part of any causal inference analysis. That is where\n`pybalance` comes in.\n\n## PyBalance\n\n`pybalance` is a suite of tools in python for performing confounding adjustment\nin non-randomized populations. In `pybalance`, we start with measures of \"balance\"\n(how similar two populations are) and directly optimize this metric. This approach is\ndifferent, and we think almost always better, from the well-known propensity score\napproach, in which the probability of treatment assignment is modelled, but balance metrics\nare almost always anyway implicitly defining the success criterion\n(see our [demo](https://bayer-group.github.io/pybalance/demos/ps_matcher.html)).\nOur approach here is to explicitly define and directly optimize the balance metric that\nis relevant for the given problem.\n\nThe `pybalance` library implements several routines for optimizing balance. To learn more\nabout these methods, head on over to the\n[demos](https://bayer-group.github.io/pybalance/02_demos.html). Then give\nthe code a spin for yourself by following the\n[installation instructions](https://bayer-group.github.io/pybalance/01_installation.html).\nAny questions or issues please feel free to open an [issue](https://github.com/Bayer-Group/pybalance/issues)\nor start a [discussion](https://github.com/Bayer-Group/pybalance/discussions).\n\nAn application of this library to build an external control arm in a pharmaceutical\nsetting is presented [here](https://onlinelibrary.wiley.com/doi/10.1002/pst.2352).\n\n## Features\n\n- Implements linear and non-linear optimization approaches for matching.\n- Utilizes integer program solvers and evolutionary solvers for optimization.\n- Includes implementation of propensity score matching for comparison.\n- Offers a variety of balance calculators and matchers.\n- Provides visualization tools for analysis.\n- Supports simulation of datasets for testing and demonstration purposes.\n\n## Limitations\n\nAt the moment, `pybalance` only implements matching routines. Suport for weighting\nmethods is on our roadmap and will appear in a future release.\n\n## Citation\n\nIf you use `pybalance` for your research, please acknowledge this with a citation to\nour [paper](https://onlinelibrary.wiley.com/doi/10.1002/pst.2352).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayer-group%2Fpybalance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbayer-group%2Fpybalance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayer-group%2Fpybalance/lists"}