Skip to main content

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.

test status

[!NOTE] The original estimation implementations are from ivanvoitalov/tail-estimation, which is based on the paper (Voitalov et al. 2019). tailestim is a wrapper package that provides a more convenient/modern interface and logging, that can be installed using pip and conda.

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.

  1. Hill Estimator (HillEstimator)
    • Classical Hill estimator with double-bootstrap for optimal threshold selection
    • Generally recommended for power law analysis
  2. Moments Estimator (MomentsEstimator)
    • Moments-based estimation with double-bootstrap
    • More robust to certain types of deviations from pure power law
  3. Kernel-type Estimator (KernelEstimator)
    • Kernel-based estimation with double-bootstrap and bandwidth selection
  4. Pickands Estimator (PickandsEstimator)
    • Pickands-based estimation (no bootstrap)
    • Provides arrays of estimates across different thresholds
  5. 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_KONECT
  • Libimseti_in_KONECT
  • Pareto

Load any example dataset using:

from tailestim import TailData
data = TailData(name='dataset_name').data

Loaded data

References

License

tailestim is distributed under the terms of the MIT license.

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

tailestim-0.1.2.tar.gz (69.1 kB view details)

Uploaded Source

Built Distribution

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

tailestim-0.1.2-py3-none-any.whl (72.3 kB view details)

Uploaded Python 3

File details

Details for the file tailestim-0.1.2.tar.gz.

File metadata

  • Download URL: tailestim-0.1.2.tar.gz
  • Upload date:
  • Size: 69.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tailestim-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0b42ec67b5350c0f0c8d7b81f7f541b5e8b090dfd56488f9d01bd857b7eb3343
MD5 35e8eeb08e07bae67993eca8af8503c3
BLAKE2b-256 f129ee2a982f5a6edee141f0796efd52d850e52005c5305a9c61236328b65575

See more details on using hashes here.

Provenance

The following attestation bundles were made for tailestim-0.1.2.tar.gz:

Publisher: release.yml on mu373/tailestim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tailestim-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tailestim-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 72.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tailestim-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 19d82c9e7bcaa1d8ffaa71975ccee0599b4d902a2b506062b63311d400faebda
MD5 75d05019b7e9e6d7ef1c5c86705165f2
BLAKE2b-256 f089e6ea35e24602ad037fcd45731a0bb921d8f8d56c02684e5780388ba84697

See more details on using hashes here.

Provenance

The following attestation bundles were made for tailestim-0.1.2-py3-none-any.whl:

Publisher: release.yml on mu373/tailestim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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