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.
| Name | Downloads | Version | Platforms |
|---|---|---|---|
conda install -c conda-forge statistapip install statistapip install git+https://github.com/serapeum-org/statista- 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
- 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
- One-at-a-time (OAT): Analyze parameter sensitivity individually
- Sobol Visualization: Visualize parameter interactions and importance
- Descriptive Statistics: Comprehensive statistical descriptors
- Time Series Analysis: Auto-correlation and other time series tools
- Visualization: Publication-quality plots for statistical analysis
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()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}")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
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
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}
}