Skip to main content

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

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (pytest tests/)
  5. Commit your changes (git commit -m 'feat: Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Release Process

The release process is automated through GitHub Actions:

  1. Update version in setup.py
  2. Add entry to CHANGELOG.md
  3. Commit changes
  4. Create and push a tag:
    git tag -a v0.x.x -m "Release version 0.x.x"
    git push origin v0.x.x
    
  5. 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.


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stats_confidence_intervals-0.2.3.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stats_confidence_intervals-0.2.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file stats_confidence_intervals-0.2.3.tar.gz.

File metadata

File hashes

Hashes for stats_confidence_intervals-0.2.3.tar.gz
Algorithm Hash digest
SHA256 52ae5e0d38041d47c6979ee592c8b98adcc485eb434ff2b4000d07caf6202660
MD5 932771f2d1551464a4ed41d1dcfd4d6a
BLAKE2b-256 ddfd672f4b3eb0c54f7cf0fc337567e14b17212dbcac4d63c6293fd7c5a12764

See more details on using hashes here.

File details

Details for the file stats_confidence_intervals-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for stats_confidence_intervals-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4932fc9b3c7536b1aa7896786ba6251a72bac38aac4211f96a112bf4dbd60eec
MD5 29291f0e69802d9c0b83650565957ecd
BLAKE2b-256 3a2b994fbdc9489e6ea88e18055e1dd522fe86a81f9dfc2912965aa6b83687b0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page