Skip to main content

No project description provided

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.

[!NOTE] The original estimation implementations are from ivanvoitalov/tail-estimation. This is a wrapper package that provides a more convenient and 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 dataset loader for example networks
  • Support for custom network data analysis
  • Comprehensive parameter estimation and diagnostics

Installation

pip install tailestim

Quick Start

Using Built-in Datasets

from tailestim.datasets import TailData
from tailestim.estimator import TailEstimator

# Load a sample dataset
data = TailData(name='CAIDA_KONECT').data

# Initialize and fit the estimator
estimator = TailEstimator(method='hill')
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.estimator import TailEstimator

# Create or load your network
G = nx.barabasi_albert_graph(10000, 2)
degree = list(dict(G.degree()).values()) # Degree sequence

# Initialize and fit the estimator
estimator = TailEstimator(method='hill')
estimator.fit(degree)

# Get the estimated parameters
result = estimator.get_parameters()
gamma = result['gamma']

# Print full results
print(estimator)

Available Methods

The package provides several methods for tail estimation. For details on parameters that can be specified to each methods, please refer to the original repository ivanvoitalov/tail-estimation or the actual codes.

  1. Hill Estimator (method='hill')

    • Classical Hill estimator with double-bootstrap for optimal threshold selection
    • Default method, generally recommended for power law analysis
  2. Moments Estimator (method='moments')

    • Moments-based estimation with double-bootstrap
    • More robust to certain types of deviations from pure power law
  3. Kernel-type Estimator (method='kernel')

    • Kernel-based estimation with double-bootstrap and bandwidth selection
    • Additional parameters: hsteps (int, default=200), alpha (float, default=0.6)
  4. Pickands Estimator (method='pickands')

    • Pickands-based estimation (no bootstrap)
    • Provides arrays of estimates across different thresholds
  5. Smooth Hill Estimator (method='smooth_hill')

    • Smoothed version of the Hill estimator (no bootstrap)
    • Additional parameter: r_smooth (int, default=2)

Results

The results 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

==================================================
Tail Estimation Results (Hill Method)
==================================================

Parameters:
--------------------
Optimal order statistic (k*): 6873
Tail index (ξ): 0.6191
Gamma (powerlaw exponent) (γ): 2.6151

Bootstrap Results:
--------------------
First bootstrap minimum AMSE fraction: 0.6899
Second bootstrap minimum AMSE fraction: 0.6901

Built-in Datasets

The package includes several example datasets:

  • CAIDA_KONECT
  • Libimseti_in_KONECT
  • Pareto

Load any example dataset using:

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

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.0.2.tar.gz (66.3 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.0.2-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tailestim-0.0.2.tar.gz
  • Upload date:
  • Size: 66.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for tailestim-0.0.2.tar.gz
Algorithm Hash digest
SHA256 39db900cf550ee04635db55be492dbd7228b52370071296b620ade3ae66fc1d5
MD5 21b74aa708799652c43f8dd604115a77
BLAKE2b-256 49c066ce1e78feaab02f842c69d3cd6105cb743097d489863ba25929bb82bebb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tailestim-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for tailestim-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 783e7c3fe261da810d813fa1dd6329334a5372026484b254cbefc3acdebe45a8
MD5 76aad7168b5964e54b97a9fc81845dbd
BLAKE2b-256 976a35ec78113a553734f08994c273523e26a1d5cd56d75b881e01b68bc4e0bc

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