Skip to main content

Testing for differences in survival using hypergeometric P-values

Project description

multiHGtest -- Testing for differences in survival using multiple hypergeometric P-values

This package implements the test for survival data described in [1] Kipnis, Galili, and Yakhini. Detecting rare and weak deviations of non-proportional hazard in survival analysis. arXiv:2310.00554. 2025.

Overview

The multiHGtest package provides methods for comparing survival between two populations with sensitivity to rare hazard departures. The method uses exact hypergeometric tests at each time interval and combines the P-values using higher criticism or Fisher's combination test.

Methods

  • hypergeom_test - Exact hypergeometric test for comparing proportions
  • hchg_test / HCHGtest - Higher criticism test of hypergeometric P-values
  • fisher_hg_test / FisherHGtest - Fisher combination test of hypergeometric P-values
  • hg_test_dashboard / testHG_dashboard - Comprehensive dashboard with all test statistics

Installation

pip install multiHGtest

Quick Example

import numpy as np
from multiHGtest import hchg_test, fisher_hg_test

# Example survival data (at-risk counts over time)
Nt1 = np.array([100, 95, 90, 85, 80])  # Group 1 at-risk counts
Nt2 = np.array([100, 92, 88, 82, 75])  # Group 2 at-risk counts

# Calculate events (if not provided)
Ot1 = -np.diff(Nt1)  # [5, 5, 5, 5]
Ot2 = -np.diff(Nt2)  # [8, 4, 6, 7]

# Run tests
hc_stat = hchg_test(Nt1[:-1], Nt2[:-1], Ot1, Ot2)
fisher_stat, fisher_pval = fisher_hg_test(Nt1[:-1], Nt2[:-1], Ot1, Ot2)

print(f"Higher Criticism statistic: {hc_stat:.4f}")
print(f"Fisher statistic: {fisher_stat:.4f}, p-value: {fisher_pval:.4f}")

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

multihgtest-0.0.5.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

multihgtest-0.0.5-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file multihgtest-0.0.5.tar.gz.

File metadata

  • Download URL: multihgtest-0.0.5.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for multihgtest-0.0.5.tar.gz
Algorithm Hash digest
SHA256 84e65a95071a24d140b21e9eee329812c325b3feaac55835b014c4b117991b79
MD5 000d768bf5558364891c3042c2dbbb6c
BLAKE2b-256 a07a30f63aeb925166e9a86af9af9008c50d8e318d370d18266579e4055414a6

See more details on using hashes here.

File details

Details for the file multihgtest-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: multihgtest-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for multihgtest-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e85a8f69cf593bd7212eb6594b0444bb8fba59c2521c75026daa7b4be6318343
MD5 a1e19ac21eb8e73c8ce8ac2311f6f6fb
BLAKE2b-256 648189d5b669c0f5d1227a7d33ca2037c1616208c848edb1a2a59320d5bb5fbe

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