A Python package for estimating tail parameters of heavy-tailed distributions, which is useful for analyzing power-law behavior in complex networks.
Project description
tailestim
A Python package for estimating tail parameters of heavy-tailed distributions, which is useful for analyzing power-law behavior in complex networks. Currently in development (alpha version).
[!NOTE] The original estimation implementations are from ivanvoitalov/tail-estimation, which is based on the paper "Scale-free networks well done" (Voitalov et al. 2019).
tailestimis a wrapper package that provides a more convenient/modern interface and logging, that can be installed usingpipandconda.
Features
- Multiple estimation methods including Hill, Moments, Kernel, Pickands, and Smooth Hill estimators
- Double-bootstrap procedure for optimal threshold selection
- Built-in example datasets
Installation
pip install tailestim
Quick Start
Using Built-in Datasets
from tailestim import TailData
from tailestim import HillEstimator, KernelTypeEstimator, MomentsEstimator
# Load a sample dataset
data = TailData(name='CAIDA_KONECT').data
# Initialize and fit the Hill estimator
estimator = HillEstimator()
estimator.fit(data)
# Get the estimated parameters
result = estimator.get_parameters()
gamma = result['gamma']
# Print full results
print(estimator)
Using degree sequence from networkx graphs
import networkx as nx
from tailestim import HillEstimator, KernelTypeEstimator, MomentsEstimator
# Create or load your network
G = nx.barabasi_albert_graph(10000, 2)
degree = list(dict(G.degree()).values()) # Degree sequence
# Initialize and fit the Hill estimator
estimator = HillEstimator()
estimator.fit(degree)
# Get the estimated parameters
result = estimator.get_parameters()
gamma = result['gamma']
# Print full results
print(estimator)
Available Estimators
The package provides several estimators for tail estimation. For details on parameters that can be specified to each estimator, please refer to the original repository ivanvoitalov/tail-estimation, original paper, or the actual code.
- Hill Estimator (
HillEstimator)- Classical Hill estimator with double-bootstrap for optimal threshold selection
- Generally recommended for power law analysis
- Moments Estimator (
MomentsEstimator)- Moments-based estimation with double-bootstrap
- More robust to certain types of deviations from pure power law
- Kernel-type Estimator (
KernelEstimator)- Kernel-based estimation with double-bootstrap and bandwidth selection
- Pickands Estimator (
PickandsEstimator)- Pickands-based estimation (no bootstrap)
- Provides arrays of estimates across different thresholds
- Smooth Hill Estimator (
SmoothHillEstimator)- Smoothed version of the Hill estimator (no bootstrap)
Results
The full result can be obtained by estimator.get_parameters(), which returns a dictionary. This includes:
gamma: Power law exponent (γ = 1 + 1/ξ)xi_star: Tail index (ξ)k_star: Optimal order statistic- Bootstrap results (when applicable):
- First and second bootstrap AMSE values
- Optimal bandwidths or minimum AMSE fractions
Example Output
When you print(estimator) after fitting, you will get the following output.
==================================================
Tail Estimation Results (HillEstimator)
==================================================
Parameters:
--------------------
Optimal order statistic (k*): 26708
Tail index (ξ): 0.3974
Gamma (powerlaw exponent) (γ): 3.5167
Bootstrap Results:
--------------------
First bootstrap minimum AMSE fraction: 0.2744
Second bootstrap minimum AMSE fraction: 0.2745
Built-in Datasets
The package includes several example datasets:
CAIDA_KONECTLibimseti_in_KONECTPareto(Follows power-law with $\gamma=2.5$)
Load any example dataset using:
from tailestim import TailData
data = TailData(name='dataset_name').data
Loaded data
References
- I. Voitalov, P. van der Hoorn, R. van der Hofstad, and D. Krioukov. Scale-free networks well done. Phys. Rev. Res., Oct. 2019, doi: 10.1103/PhysRevResearch.1.033034.
- I. Voitalov.
ivanvoitalov/tail-estimation, GitHub. Mar. 2018. https://github.com/ivanvoitalov/tail-estimation.
Citations
If you use tailestim in your research or projects, I would greatly appreciate if you could cite this package, the original implementation, and the original paper (Voitalov et al. 2019).
@article{voitalov2019scalefree,
title = {Scale-free networks well done},
author = {Voitalov, Ivan and van der Hoorn, Pim and van der Hofstad, Remco and Krioukov, Dmitri},
journal = {Phys. Rev. Res.},
volume = {1},
issue = {3},
pages = {033034},
numpages = {30},
year = {2019},
month = {Oct},
publisher = {American Physical Society},
doi = {10.1103/PhysRevResearch.1.033034},
url = {https://link.aps.org/doi/10.1103/PhysRevResearch.1.033034}
}
@software{voitalov2018tailestimation,
author = {Voitalov, Ivan},
title = {tail-estimation},
month = mar,
year = 2018,
publisher = {GitHub},
url = {https://github.com/ivanvoitalov/tail-estimation}
}
@software{ueda2025tailestim,
author = {Ueda, Minami},
title = {tailestim: A Python package for estimating tail parameters of heavy-tailed distributions},
month = mar,
year = 2025,
publisher = {GitHub},
url = {https://github.com/mu373/tailestim}
}
License
tailestim is distributed under the terms of the MIT license.
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 tailestim-0.1.4.tar.gz.
File metadata
- Download URL: tailestim-0.1.4.tar.gz
- Upload date:
- Size: 69.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95e84ec5452fdf565db99a0964abcde348db376f26ad11eb73752f166b0a70da
|
|
| MD5 |
9d316b9a42d07b5bf105705faa1d9d15
|
|
| BLAKE2b-256 |
c6926554b58c22223bb24564b1f59ae3d02179b42f4bccc9d614ce8d16d175e8
|
Provenance
The following attestation bundles were made for tailestim-0.1.4.tar.gz:
Publisher:
release.yml on mu373/tailestim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tailestim-0.1.4.tar.gz -
Subject digest:
95e84ec5452fdf565db99a0964abcde348db376f26ad11eb73752f166b0a70da - Sigstore transparency entry: 175698272
- Sigstore integration time:
-
Permalink:
mu373/tailestim@7e85da4db8239e5eb6255777c84787d74a1e28a4 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/mu373
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7e85da4db8239e5eb6255777c84787d74a1e28a4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tailestim-0.1.4-py3-none-any.whl.
File metadata
- Download URL: tailestim-0.1.4-py3-none-any.whl
- Upload date:
- Size: 72.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4754318e09ad02d86e2f8ea74acfbc9c28d640824f6717207c5edb014e7599e
|
|
| MD5 |
89623aaf9d225092815a46c4883409e2
|
|
| BLAKE2b-256 |
49af5ba6de21589ae21d73d72629c690867c360f7fdd806dd8b3e60262ae930a
|
Provenance
The following attestation bundles were made for tailestim-0.1.4-py3-none-any.whl:
Publisher:
release.yml on mu373/tailestim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tailestim-0.1.4-py3-none-any.whl -
Subject digest:
b4754318e09ad02d86e2f8ea74acfbc9c28d640824f6717207c5edb014e7599e - Sigstore transparency entry: 175698273
- Sigstore integration time:
-
Permalink:
mu373/tailestim@7e85da4db8239e5eb6255777c84787d74a1e28a4 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/mu373
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7e85da4db8239e5eb6255777c84787d74a1e28a4 -
Trigger Event:
release
-
Statement type: