A comprehensive library for calculating and visualizing statistical confidence intervals
Project description
Confidence Interval Library
A Python library for calculating and visualizing confidence intervals.
Installation
pip install confidence_interval
Features
- Calculate confidence intervals for means
- Calculate confidence intervals for proportions using:
- Wilson score method (recommended for small sample sizes)
- Normal approximation method (for large sample sizes)
- Visualize confidence intervals with customizable plots
- Support for both list and numpy array inputs
- Comprehensive error checking and validation
Usage
Mean Confidence Interval
from confidence_interval.core import mean_confidence_interval
import numpy as np
data = np.random.normal(100, 15, size=50)
ci = mean_confidence_interval(data, confidence=0.95)
print(f"Mean: {ci.estimate:.2f}")
print(f"95% CI: ({ci.lower_bound:.2f}, {ci.upper_bound:.2f})")
Proportion Confidence Interval
from confidence_interval.core import proportion_confidence_interval
successes = 45
total = 100
ci = proportion_confidence_interval(successes, total, confidence=0.95, method='wilson')
print(f"Proportion: {ci.estimate:.2f}")
print(f"95% CI: ({ci.lower_bound:.2f}, {ci.upper_bound:.2f})")
Development
This project uses GitHub Actions for automated testing and deployment. The workflow includes:
- Automated tests on Python versions 3.8-3.12
- Automatic releases when tags are pushed
- Automated PyPI publishing
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
pytest tests/) - Commit your changes (
git commit -m 'feat: Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Release Process
The release process is automated through GitHub Actions:
- Update version in
setup.py - Add entry to
CHANGELOG.md - Commit changes
- Create and push a tag:
git tag -a v0.x.x -m "Release version 0.x.x" git push origin v0.x.x
- GitHub Actions will automatically:
- Create a GitHub release
- Run tests
- Publish to PyPI
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
See CHANGELOG.md for a list of changes and version history.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stats_confidence_intervals-0.2.3.tar.gz.
File metadata
- Download URL: stats_confidence_intervals-0.2.3.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52ae5e0d38041d47c6979ee592c8b98adcc485eb434ff2b4000d07caf6202660
|
|
| MD5 |
932771f2d1551464a4ed41d1dcfd4d6a
|
|
| BLAKE2b-256 |
ddfd672f4b3eb0c54f7cf0fc337567e14b17212dbcac4d63c6293fd7c5a12764
|
File details
Details for the file stats_confidence_intervals-0.2.3-py3-none-any.whl.
File metadata
- Download URL: stats_confidence_intervals-0.2.3-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4932fc9b3c7536b1aa7896786ba6251a72bac38aac4211f96a112bf4dbd60eec
|
|
| MD5 |
29291f0e69802d9c0b83650565957ecd
|
|
| BLAKE2b-256 |
3a2b994fbdc9489e6ea88e18055e1dd522fe86a81f9dfc2912965aa6b83687b0
|