skbold.postproc.prevalence module

class PrevalenceInference(obs, perms, P2=100000, gamma0=0.5, alpha=0.05)[source]

Bases: object

Class that performs PrevalenceInference based on the paper by Allefeld, Gorgen, & Haynes (2016), NeuroImage.

Parameters:
  • obs (numpy ndarray) – A 2D array of shape [N (subjects) x K (voxels)], or a 1D array of shape [N, 1].
  • perms (numpy ndarray) – A 3D array of shape [N (subjects) x K (voxels) x P1 (first level permutations)], or a 2D array of shape [N x P1]
  • P2 (int) – Number of second level permutations to run
  • gamma0 (float) – What prevalence inference null (gamma < gamma0) to test
  • alpha (float) – Significance level for hypothesis testing

Examples

>>> from skbold.postproc import PrevalenceInference
>>> import numpy as np
>>> N, K, P1 = 20, (40, 40, 38), 15
>>> obs = np.random.normal(loc=0.55, scale=0.05, size=(N, np.prod(K)))
>>> perms = np.random.normal(loc=0.5, scale=0.05, size=(N, np.prod(K), P1))
>>> pvi = PrevalenceInference(obs=obs, perms=perms, P2=100000, gamma0=05,
                              alpha=0.05)
>>> pvi.run()
Running with parameters:
    N = 20
    K = 60800
    P1 = 15
    P2 = 100000
__init__(obs, perms, P2=100000, gamma0=0.5, alpha=0.05)[source]

Initializes PrevalenceInference object.

run()[source]

Runs actual prevalence inference algorithm.

write(path)[source]

Writes results from Prevalence Inference procedure to disk.

Parameters:path (str) – Where to write the results to disk