Skip to main content

HierarchiaPy: statistical package to derive hiearchy from social interactions

Project description

Build Status LICENCE codecov Documentation Status PyPI version


Introduction

HierarchiaPy is an optimized statistical package for hierarchy/dominance analysis methds. It is purely written in Python and mainly built on Pandas and NumPy. Interarction data can be parsed both from Pandas DataFrame and 2D Numpy array. The methods are implemented based on the original published papers and tests module designed to cross-check the results with the examples from the reference papers.

Dominance and hierarchy is one of the core concepts in the research field of animal social behaviour. The hierarchy (dominance) can be derived from the interactions between the individuals (dyadic relationships). There are numerous techniques to derive the dominance from such dataset. We can classify them into two categories; numerical matrix optimization for certain criteria which results in a rank order (1) and calculation of a certain dominance measure for each individual from which a rank can be computed (2).

The HierarchiaPy statistical python package aims to implement available methods from both categories, allowing the animal social scientists to derive dominance efficiently, easily and in a reproducible way.

Methods: Stable release

  1. ELO rating
  2. Randomized ELO rating
  3. David's Scores
  4. Average Dominance Index
  5. Adagio
  6. I&SI 98

Linearity Tests: Stable release

  1. Landau's h
  2. Improved Landau's h
  3. Kendall's K (Chi-square approximation & ECDF for n<10)
  4. Unbiased Kendall's K (permutation of unknown relationships)

Methods: Under Development

  1. I&SI 13

Quick Start

Installation

PyPI publication is under process, for now use pip + git

!pip install HierarchiaPy

Basic Usage

from HierarchiaPy import Hierarchia
import numpy as np

mat_hemelrijk_table_2_1 = np.array([[0, 6, 9, 8, 5],
                                    [0, 0, 4, 6, 0],
                                    [0, 2, 0, 4, 7],
                                    [1, 0, 5, 0, 3],
                                    [0, 0, 2, 3, 0]], dtype='int64')

hier_mat = Hierarchia(mat_hemelrijk_table_2_1, np.array(['a', 'b', 'c', 'd', 'e']))
davids_scores = hier_mat.davids_score()

print(davids_scores)

Output:

{'a': 8.4444, 'b': 1.6111, 'c': -2.3333, 'd': -3.6667, 'e': -4.0556}

Documentation

For full functionality and reference, see the documentation

Change Log

v 0.1.0 - Initial release
v 0.2.0 - Inclusion of linearity statistics & tests

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

HierarchiaPy-0.2.1.tar.gz (36.2 kB view details)

Uploaded Source

File details

Details for the file HierarchiaPy-0.2.1.tar.gz.

File metadata

  • Download URL: HierarchiaPy-0.2.1.tar.gz
  • Upload date:
  • Size: 36.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.13

File hashes

Hashes for HierarchiaPy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a7c130f369cdbc3abe9a6ee2a0fcf2bbaa23380c2eff7aba6001e685299c1647
MD5 c2b4fff6a52a411239d7cb23c6b28b55
BLAKE2b-256 a7a3e149b0aa23fc1c15b8580b7c65e635611f9735ec83b72b4fd657e5155826

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page