🌌 MixStable — Alpha-Stable Mixture Estimation Package
A comprehensive Python package for simulating, estimating, and visualizing alpha-stable mixture distributions.
This toolkit is designed for statisticians, data scientists, and researchers working with heavy-tailed or skewed data, where Gaussian models fail to capture real-world complexity.
Key Features
Robust Estimation Methods
- Empirical Characteristic Function (ECF) estimators: kernel-based and weighted OLS
- Maximum Likelihood Estimation (MLE)
- Quantile-based and CDF-based approaches
Mixture Modeling with EM
- EM algorithm for two-component alpha-stable mixtures
- Flexible estimator choice inside the EM loop
- Optional integration with Gibbs sampling for Bayesian refinement
Visualization & Simulation
- Generate synthetic alpha-stable data
- Built-in visualization tools and an interactive Streamlit dashboard
R Integration (via rpy2)
- Uses R’s
stabledistpackage to evaluate stable densities and CDFs - Leverage mature R statistical methods directly from Python
Testing & Evaluation
- Built-in diagnostics and model-fit tools
- Evaluation metrics and example datasets
Installation
Install directly from PyPI:
pip install Mixstable
Or clone the repository and install in editable mode:
git clone https://github.com/AdamNajib/MixStable.git
cd src
pip install -e .
Install the required R package (for rpy2 integration):
install.packages("stabledist")
Running the Interactive Dashboard
To launch the Streamlit app for interactive parameter tuning and visualization:
streamlit run interface/app.py
Usage Example
Estimate parameters from synthetic data:
from mixstable import generate_sample, em
# Generate alpha-stable samples
samples = generate_sample.generate_alpha_stable(alpha=1.7, beta=0, gamma=1, delta=0, size=1000)
# Fit a two-component mixture model using EM
result = em.run_em_algorithm(samples, num_components=2, max_iter=50)
print(result['params'])
Requirements
- Python ≥ 3.8
- R (if using
r_interface) stabledistR package
Python dependencies (auto-installed from requirements.txt):
numpy,scipy,matplotlib,seaborn,statsmodelsrpy2,pandas,tqdm,scikit-learn,streamlit
Project Structure
Mixstable/
│
├── src/
│ ├── Mixstable/ # Core modules
│ │ └── em.py, gibbs.py, ecf.py, ...
│ ├── interface/ # Streamlit dashboard
│ └── tests/ # Test scripts
│
├── README.md
├── setup.py
├── pyproject.toml
└── requirements.txt
Package Overview
| Module | Description |
|---|---|
em.py |
Expectation-Maximization algorithm implementation |
gibbs.py |
Gibbs sampling routines for Bayesian inference |
ecf.py |
Empirical characteristic function estimators |
generate_sample.py |
Alpha-stable data generation tools |
interface/ |
Streamlit dashboard and helper scripts |
tests/ |
Unit and integration tests |
Example Output
Example EM fit visualization (from Streamlit app):
Iteration 50/50
Component 1: α = 1.72, β = 0.05, γ = 1.1, δ = 0.02
Component 2: α = 1.54, β = -0.10, γ = 0.8, δ = 2.4
Log-likelihood: -1856.42
Theoretical Background
Alpha-stable distributions generalize the Gaussian family to model heavy-tailed and skewed data. They are defined by four parameters:
| Parameter | Symbol | Meaning |
|---|---|---|
| Stability | α | Controls tail thickness (0 < α ≤ 2) |
| Skewness | β | Controls asymmetry (−1 ≤ β ≤ 1) |
| Scale | γ | Controls spread (> 0) |
| Location | δ | Controls center (real number) |
This package provides both simulation tools and inference routines for mixtures of alpha-stable laws, extending beyond Gaussian mixtures.
References
Hajjaji, O., Manou-Abi, S. M., & Slaoui, Y. (2024). Parameter estimation for stable distributions and their mixture. Journal of Applied Statistics, 52(8), 1594–1627. https://doi.org/10.1080/02664763.2024.2434627
Authors
Solym Manou-Abi Email: [solym.manou.abi@univ-poitiers.fr]
Adam Najib Email: [najibadam145@gmail.com] GitHub: @AdamNajib
Yousri Slaoui Email: [Yousri.Slaoui@math.univ-poitiers.fr]
Metadata
Release files for Mixstable 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mixstable-0.1.8.tar.gz | 65.3 kB | Without provenance | Details for mixstable-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mixstable-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for mixstable-0.1.8-py3-none-any.whl |
Total release size: 140.9 kB
Release files / mixstable-0.1.8.tar.gz
| Download URL | mixstable-0.1.8.tar.gz |
|---|---|
| Size | 65.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8003414e1f473f2b4cf861db91dce214c6ef15227225daa867a405d010f0362
|
|
BLAKE2b-256 checksum How to use checksums |
a297c98c307bcc6093c834f1d61219ea29054047a973cb46deb4d4391257a437
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.10
|
Release files / mixstable-0.1.8-py3-none-any.whl
| Download URL | mixstable-0.1.8-py3-none-any.whl |
|---|---|
| Size | 75.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d94f39553f8d5fbc83b6520526cc9cdca62733496d92b114cbf613de7db7973
|
|
BLAKE2b-256 checksum How to use checksums |
74efb30f5b8d3f0b3971437f886e4a594c38bc90622981e83630e361d5874422
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.10
|
Security for Mixstable 0.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.