Skip to content

Commit

Permalink
Boom
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Nov 28, 2022
1 parent debeb4e commit 6d4fee8
Show file tree
Hide file tree
Showing 12 changed files with 345 additions and 717 deletions.
52 changes: 33 additions & 19 deletions .github/workflows/continuous-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install pipenv
run: pipx install pipenv

- uses: actions/setup-python@v3
- id: setup-python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pipenv'

- id: pipenv-install
- id: install-pipenv
name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
shell: bash

- id: install-python-dependencies
name: Install Python dependencies
run: pipenv install --dev --python `which python`
run: pipenv install --dev --python=`which python`
shell: bash

- id: run
name: Run
Expand All @@ -37,17 +42,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install pipenv
run: pipx install pipenv

- uses: actions/setup-python@v3
- id: setup-python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
python-version: '3.9'
cache: 'pipenv'

- id: pipenv-install
- id: install-pipenv
name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
shell: bash

- id: install-python-dependencies
name: Install Python dependencies
run: pipenv install --skip-lock --python `which python`
run: pipenv install --dev --python=`which python`
shell: bash

- id: run
Expand All @@ -63,17 +72,22 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install pipenv
run: pipx install pipenv

- uses: actions/setup-python@v3
- id: setup-python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pipenv'

- id: pipenv-install
- id: install-pipenv
name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
shell: bash

- id: install-python-dependencies
name: Install Python dependencies
run: pipenv install --dev --python `which python`
run: pipenv install --dev --python=`which python`
shell: bash

- id: build
name: Build release
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/docs.yaml

This file was deleted.

442 changes: 243 additions & 199 deletions Pipfile.lock

Large diffs are not rendered by default.

71 changes: 69 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,73 @@
### Links
# census-error-analyzer

Analyze the margin of error in U.S. census data

## Installation

```bash
pipenv install census-error-analyzer
```

## Usage

Import the library.

```python
import census_error_analyzer
```

### Test statistical difference

Are two values, considering their respective margins of error, statistically different? The Census Bureau advises that this test be conducted for all comparisons. This test answers the question and returns `True` or `False`.

Accepts two lists, each expected to be a pair with a value and its margin of error.

```python
us_medianage, us_medianage_moe = 37.9, 0.1
nyc_medianage, nyc_medianage_moe = 38.4, 0.1
census_error_analyzer.is_statistically_different(
(us_medianage, us_medianage_moe), (nyc_medianage, nyc_medianage_moe)
)
True
```

The precise difference can also be accessed. According to the Census Bureau, values greater than 1.0 can be considered to be statistically significant.

```python
census_error_analyzer.statistical_difference(
(us_medianage, us_medianage_moe), (nyc_medianage, nyc_medianage_moe)
)
3.535533905932737
```

### Get statistical range

The minimum and maximum values in an estimate's statistical range given its margin of error. Expects two arguments: The estimate first. The margin of error second.

```python
census_error_analyzer.statistical_range(us_medianage, us_medianage_moe)
37.8, 38.0
```

### Convert to alternative confidence levels

The margins of error published by the Census are at the 90% confidence level. They can be converted to the 95% and 99% levels using tools in this library.

```python
census_error_analyzer.convert_to_95_percent_confidence(3778)
4501.446808510638
census_error_analyzer.convert_to_99_percent_confidence(3778)
5925.373860182372
```

## References

This module was designed to conform with the Census Bureau's April 18, 2018, presentation ["Using American Community Survey Estimates and Margin of Error."](https://www.documentcloud.org/documents/6162551-20180418-MOE.html)

Prior to publication, the code was reviewed by Brian Dumbacher, a mathematical statistician in the U.S. Census Bureau's Economic Statistical Methods Division.

## Links

* Docs: [palewi.re/docs/census-error-analyzer/](https://palewi.re/docs/census-error-analyzer/)
* Issues: [github.com/datadesk/census-error-analyzer/issues](https://github.com/datadesk/census-error-analyzer/issues)
* Packaging: [pypi.python.org/pypi/census-error-analyzer](https://pypi.python.org/pypi/census-error-analyzer)
* Testing: [github.com/datadesk/census-error-analyzer/actions](https://github.com/datadesk/census-error-analyzer/actions)
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

Loading

0 comments on commit 6d4fee8

Please sign in to comment.