PyEI
PyEI: A Python package for ecological inference - Published in JOSS (2021)
Science Score: 93.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 9 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Scientific Fields
Repository
Ecological inference, in Python
Basic Info
Statistics
- Stars: 32
- Watchers: 6
- Forks: 12
- Open Issues: 5
- Releases: 12
Metadata Files
README.md
PyEI
PyEI is a Python library for ecological inference. The target audience is the analyst with an interest in the phenomenon called Racially Polarized Voting.
Racially Polarized Voting is a legal concept developed through case law under the Voting Rights Act of 1965; its genesis is in the majority opinion of Thornburg v. Gingles (1982). Considered the “evidentiary linchpin” for vote dilution cases, RPV is a necessary, but not sufficient, condition that plaintiffs must satisfy for a valid claim.
Toward that end, ecological inference uses observed data (historical election results), pairing voting outcomes with demographic information for each precinct in a given polity, to infer voting patterns for each demographic group.
PyEI brings together a variety of ecological inference methods in one place and facilitates reporting and plotting results; quantifying the uncertainty associated with results under a given model; making comparisons between methods; and bringing relevant diagnostic tools to bear on ecological inference methods.
PyEI is relatively new and under active development, so expect rough edges and bugs -- and for additional features and documentation to be coming quickly!
Want to use PyEI? Start here.
Installation
You can install the latest release from PyPi with:
pip install pyei
Or, install directly from GitHub for the most up-to-date (but potentially less stable) version:
pip install git+https://github.com/mggg/ecological-inference.git
If you would like to explore PyEI without installation, you can explore this interactive Colab notebook (just note that inference might be slow!)
Example notebooks
Check out the intro notebooks and example notebooks for sample code that shows how to run and adjust the various models in PyEI on datesets.
If you are new to ecological inference generally, start with pyei/intro_notebooks/Introduction_toEI.ipynb.
If you are familiar with ecological inference and want an overview of PyEI and how to use it (with examples), then start with intro_notebooks/PyEI_overview.ipynb.
To explore EI's plotting functionality, check out pyei/intro_notebooks/Plotting_with_PyEI.ipynb.
For more work with two-by-two examples, see in pyei/examples/santa_clara_demo.ipynb.
For more work with r-by-c examples, see pyei/examples/santa_clara_demo_r_by_c.ipynb.
For examples of model comparison and checking steps with PyEI, see pyei/examples/model_eval_and_comparison_demo.ipynb.
Issues
Feel free to file an issue if you are running into trouble or if there is a feature you'd particularly like to see, and we will do our best to get to it!
Want to contribute to PyEI? Start here.
Contributions are welcome!
Uses Python 3.10. After cloning the repository, you should be able to use either virtualenv or conda to set up your environment. The second (conda) is probably easier for development, but virtualenv is used for the project's CI.
Here is how to create and activate each environment. See the docs for more elaborate details:
Install with virtualenv
bash
virtualenv pyei_venv # create virtualenv
source pyei_venv/bin/activate # activate virtualenv
python -m pip install -U pip # upgrade pip
python -m pip install -e . # install project locally
python -m pip install -r requirements-dev.txt # install dev requirements
Install with conda
bash
conda create --name pyei --channel conda-forge python=3.10 --file requirements.txt --file requirements-dev.txt # create conda environment and install requirements
conda activate pyei
pip install -e . #install project locally
Testing
After making changes, make sure everything works by running
bash
./scripts/lint_and_test.sh
This will also run automatically when you make a pull request, so if you have trouble getting that to run, just open the PR, and we can help!
Citation
If you are using PyEI, please cite it as:
Knudson et al., (2021). PyEI: A Python package for ecological inference. Journal of Open Source Software, 6(64), 3397, https://doi.org/10.21105/joss.03397
BibTeX:
@article{Knudson2021,
doi = {10.21105/joss.03397},
url = {https://doi.org/10.21105/joss.03397},
year = {2021},
publisher = {The Open Journal},
volume = {6},
number = {64},
pages = {3397},
author = {Karin C. Knudson and Gabe Schoenbach and Amariah Becker},
title = {PyEI: A Python package for ecological inference},
journal = {Journal of Open Source Software}
}
Owner
- Name: Metric Geometry and Gerrymandering Group
- Login: mggg
- Kind: organization
- Email: engineering@mggg.org
- Location: Boston, MA
- Website: https://mggg.org
- Repositories: 59
- Profile: https://github.com/mggg
A nonpartisan research organization studying applications of geometry and computing to U.S. redistricting. See also @mggg-states for data and @gerrymandr.
JOSS Publication
PyEI: A Python package for ecological inference
Authors
Tags
voting rights ecological inference Bayesian inferenceGitHub Events
Total
- Release event: 2
- Watch event: 5
- Issue comment event: 3
- Push event: 5
- Pull request event: 8
- Create event: 4
Last Year
- Release event: 2
- Watch event: 5
- Issue comment event: 3
- Push event: 5
- Pull request event: 8
- Create event: 4
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Karin Knudson | k****0@g****m | 252 |
| Gabe Schoenbach | g****h@g****m | 46 |
| Colin Carroll | c****l@g****m | 22 |
| Matthew Sun | m****6@g****m | 17 |
| Amy Becker | a****r@g****m | 5 |
| Gabe Schoenbach | g****e@g****l | 2 |
| thomasweighill | t****l@g****m | 1 |
| ccthegreat313 | c****9@g****m | 1 |
| Todd Hendricks | h****a@g****m | 1 |
| Peter | 2****2 | 1 |
| JN | j****s@g****m | 1 |
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 37
- Total pull requests: 78
- Average time to close issues: 3 months
- Average time to close pull requests: 3 days
- Total issue authors: 12
- Total pull request authors: 8
- Average comments per issue: 1.35
- Average comments per pull request: 0.54
- Merged pull requests: 77
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 6
- Average time to close issues: N/A
- Average time to close pull requests: about 17 hours
- Issue authors: 1
- Pull request authors: 2
- Average comments per issue: 0.0
- Average comments per pull request: 1.17
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- matt-graham (16)
- karink520 (8)
- pmyteh (2)
- ColCarroll (2)
- bblpo (2)
- mitch-at-orika (1)
- methyllorange (1)
- catherinebrennan (1)
- mdthaqif (1)
- kam-stand (1)
- MalavikaMukundan (1)
- qu-genesis (1)
Pull Request Authors
- karink520 (53)
- ColCarroll (13)
- gabeschoenbach (11)
- amybecker (2)
- tahentx (1)
- chanelrichardson (1)
- jenni-niels (1)
- sunnymatt (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 47 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 13
- Total maintainers: 1
pypi.org: pyei
- Homepage: https://github.com/mggg/ecological-inference
- Documentation: https://pyei.readthedocs.io/
- License: mit
-
Latest release: 1.1.4
published 6 months ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v2 composite
- actions/setup-python v2 composite
- black * development
- mypy * development
- pylint * development
- pytest * development
- pytest-cov * development
- arviz *
- graphviz *
- jax *
- jaxlib *
- matplotlib *
- netCDF4 *
- numba *
- numpy *
- numpyro *
- pandas *
- pymc >=5.10.0
- scikit-learn *
- seaborn *
