Skip to main content

Threshold Free Network Based Statistics (TFNBS) Toolkit

Project description

Threshold-Free Network-Based Statistics in Neuroscience

TFNBS

size license release last-commit TFNBS

TFNBS Toolbox is a Python package for computation and generation of network-based statistics for neuroscience data (i.e. fMRI, EEG data). The core concept is based on eliminating the use of a hardcoded threshold using threshold-free cluster enhancement (TFCE) scores to assess statistical significance. It works on the principle of networks, where TFCE statistical values are computed across a range of thresholds over n cycles of permutations to uncover possible significance in the data. Our implementation of TFNBS follows efficient computing and allows for computations to be performed on parallel cores therefore massively reducing computation time and resources.

Overview of TFNOS

Installation

TFNOS toolbox can be installed using:

    !pip install tfnbs

Documentation

For more information on TFNBS's features, modules and usage, please refer to the official documentation.

Examples of usage on fMRI and EEG data are avaialble in notebooks and data.

Permutation p-values (compute_p_val)

The main entry point for permutation-based inference is tfnbs.pairwise_stats.compute_p_val.

Supported method values:

  • tstat: raw t-statistics (max-stat correction)
  • tfnbs: threshold-free NBS / TFCE-style enhancement
  • nbs: classical NBS with fixed threshold (nbs_stat="extent" or "intensity")
  • cnbs: constrained NBS (requires net_labels)
  • ni_tfnbs: network-informed TFNBS (requires net_labels)
  • fbc_tfnbs: functional-block clustering TFNBS (requires net_labels)

Minimal example (two-sample):

from tfnbs.pairwise_stats import compute_p_val
from tfnbs.utils import fisher_r_to_z

# group1, group2: arrays of shape (n_subjects, N, N), symmetric, diagonal=0
group1_z = fisher_r_to_z(group1)
group2_z = fisher_r_to_z(group2)

p_vals = compute_p_val(
    group1_z,
    group2_z,
    n_permutations=1000,
    test_type="two-sample",
    method="tfnbs",
    use_mp=True,
)

Notes:

  • Constrained methods (cnbs, ni_tfnbs, fbc_tfnbs) require net_labels: ndarray[int] of shape (N,).
  • NBS uses threshold and nbs_stat; TFNBS-family uses e, h, n, and start_thres (plus min_cluster_size for fbc_tfnbs).

Synthetic method-comparison example

See examples/sim_method_comparisons.py which compares all methods via compute_p_val and saves GT/t-stat/1-p heatmaps:

python examples/sim_method_comparisons.py --all-scenarios --effect-size 0.25 --time-points 50 --n-permutations 50

Citing the toolbox

To cite the toolbox, you can use: doi and refer to the paper paper_doi

    [doi]

For further discussions or reports on bugs, please contact ashish@ireddy.ru

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

tfnbs-1.1.0.tar.gz (48.2 kB view details)

Uploaded Source

Built Distribution

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

tfnbs-1.1.0-py3-none-any.whl (55.3 kB view details)

Uploaded Python 3

File details

Details for the file tfnbs-1.1.0.tar.gz.

File metadata

  • Download URL: tfnbs-1.1.0.tar.gz
  • Upload date:
  • Size: 48.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for tfnbs-1.1.0.tar.gz
Algorithm Hash digest
SHA256 3ee15011db351883aaa07c6f91e1a443bbd6c4dd80993a2ea2cf7befc7c199ff
MD5 c4e9669ea760841400fd28ec29c79e18
BLAKE2b-256 f1207118dc3fd90ceb5c0130367bcd9fda928a2161a8eeedc7e8a5b3090f59d4

See more details on using hashes here.

File details

Details for the file tfnbs-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: tfnbs-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 55.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for tfnbs-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8bcd54da663ac1f422849476578fbaf71f57835ee96e1348a0dda232d166c1f
MD5 3f0a3740dbb314e7bd19a5908fe68055
BLAKE2b-256 fb6bee7bdc283327073309a25b56b7503cc6c59b48e56171618e6933fd95ea55

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