Skip to main content

statistics package

Project description

Statista - Advanced Statistical Analysis Package

Python Versions License: MIT Docs codecov pre-commit GitHub last commit GitHub issues GitHub stars GitHub forks

Overview

Statista is a comprehensive Python package for statistical analysis, focusing on probability distributions, extreme value analysis, and sensitivity analysis. It provides robust tools for researchers, engineers, and data scientists working with statistical models, particularly in hydrology, climate science, and risk assessment.

Current release info

Name Downloads Version Platforms
Conda Recipe Conda Downloads Downloads Downloads Downloads PyPI - Downloads Conda Version PyPI version Anaconda-Server Badge Conda Platforms Join the chat at https://gitter.im/Hapi-Nile/Hapi

conda-forge feedstock

Conda-forge feedstock

Installation

Conda (Recommended)

conda install -c conda-forge statista

PyPI

pip install statista

Development Version

pip install git+https://github.com/serapeum-org/statista

Main Features

Statistical Distributions

  • Probability Distributions: GEV, Gumbel, Normal, Exponential, and more
  • Multi-Distribution Fitting: Fit all distributions at once and select the best fit
  • Parameter Estimation Methods: Maximum Likelihood (ML), L-moments, Method of Moments (MOM)
  • Goodness-of-fit Tests: Kolmogorov-Smirnov, Chi-square
  • Truncated Distributions: Focus analysis on values above a threshold

Extreme Value Analysis

  • Return Period Calculation: Estimate extreme events for different return periods
  • Confidence Intervals: Calculate confidence bounds using various methods
  • Plotting Positions: Weibull, Gringorten, and other empirical distribution functions

Sensitivity Analysis

  • One-at-a-time (OAT): Analyze parameter sensitivity individually
  • Sobol Visualization: Visualize parameter interactions and importance

Statistical Tools

  • Descriptive Statistics: Comprehensive statistical descriptors
  • Time Series Analysis: Auto-correlation and other time series tools
  • Visualization: Publication-quality plots for statistical analysis

Quick Start

Single Distribution

import numpy as np
from statista.distributions import Distributions

# Load your data
data = np.loadtxt("examples/data/time_series2.txt")

# Create a distribution object and fit parameters
dist = Distributions("Gumbel", data=data)
params = dist.fit_model(method="lmoments", test=False)
print(params.loc, params.scale)

# Calculate PDF and CDF
pdf = dist.pdf(plot_figure=True)
cdf, _, _ = dist.cdf(plot_figure=True)

# Goodness-of-fit tests
ks_stat, ks_pvalue = dist.ks()
chi_stat, chi_pvalue = dist.chisquare()

Multi-Distribution Fitting

from statista.distributions import Distributions

# Fit all distributions and find the best one
dist = Distributions(data=data)
best_name, best_info = dist.best_fit()
print(f"Best: {best_name}")
print(f"Parameters: {best_info['parameters']}")

# Or fit all and inspect results
results = dist.fit()
for name, info in results.items():
    print(f"{name}: KS p-value={info['ks'][1]:.4f}")

Extreme Value Analysis

from statista.distributions import Distributions, PlottingPosition

# Fit a GEV distribution using L-moments
gev_dist = Distributions("GEV", data=data)
params = gev_dist.fit_model(method="lmoments")

# Calculate non-exceedance probabilities
cdf_weibul = PlottingPosition.weibul(data)

# Calculate confidence intervals
lower_bound, upper_bound, fig, ax = gev_dist.confidence_interval(
    plot_figure=True
)

For more examples and detailed documentation, visit Statista Documentation

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use Statista in your research, please cite it as:

Farrag, M. (2023). Statista: A Python package for statistical analysis, extreme value analysis, and sensitivity analysis.
https://github.com/serapeum-org/statista

BibTeX:

@software{statista2023,
  author = {Farrag, Mostafa},
  title = {Statista: A Python package for statistical analysis, extreme value analysis, and sensitivity analysis},
  url = {https://github.com/serapeum-org/statista},
  year = {2023}
}

Project details


Download files

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

Source Distribution

statista-0.8.0.tar.gz (4.0 MB view details)

Uploaded Source

Built Distribution

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

statista-0.8.0-py3-none-any.whl (146.3 kB view details)

Uploaded Python 3

File details

Details for the file statista-0.8.0.tar.gz.

File metadata

  • Download URL: statista-0.8.0.tar.gz
  • Upload date:
  • Size: 4.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for statista-0.8.0.tar.gz
Algorithm Hash digest
SHA256 af8ab8d17e94d72bb6abab80a6141711150d1482ea64e6ec679e05247d784261
MD5 90b42f0e56b95276dd6557cc49b1b514
BLAKE2b-256 c0abeaad74ffaea9ed201f238ab861aba4fa00133fa49b5203869a779e3ab70a

See more details on using hashes here.

File details

Details for the file statista-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: statista-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 146.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for statista-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f269ea6d260dc6bec02c0ece665bb0673e6cdd9945a9bf5cc3967d8bd09241fb
MD5 1694c299a14be3d4f1003e2eed178a05
BLAKE2b-256 f97fd8cbabf3ba7ada509c0282a6e9c2183d01c8c1b037bba0583a5c68255e05

See more details on using hashes here.

Supported by

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