Skip to content

sjdavenport/pyperm

Repository files navigation

PyPerm

This package performs inference on in high-dimensional linear models using permutation and the bootstrap. In particular it provides post-hoc inference for multiple testing methods when considering multiple contrasts. This package is written together with the SanSouci python package which performs post-hoc inference when the exchangeability hypothesis holds. For further details on the methodology and relevant papers see https://www.math.univ-toulouse.fr/~pneuvial/sanssouci.html and our preprint: https://arxiv.org/abs/2208.13724.

Table of contents

Getting Started

The majority of the code is available in the pyperm subfolder. The best way to get started is to work through the Jupyter Notebook: contrast_examples.ipynb available in the Examples folder.

Code Structure

The code for this package is contained within the pyperm subfolder. This section contains a general description of the files with the most important functions.

cluster_inference.py

This file contains functions for calculating clusters and perform FDP inference on clusters.

fdp.py

This file contains functions for running the Benjamini-Hochberg procedure to control the FDR as well as functions to run step-down algorithms.

permutation.py

This file contains functions to run permutation and bootstrap resampling.

power.py

This file contains functions to compare the power of bootstrap and parametric methods as well as to generate signal with random locations.

random_field_generation.py

This file contains functions to generate noisy random fields.

Set Up

In order to install this package you'll need to download the package, go to the pyperm folder and run pip install. Many of the functions rely on code from the SanSouci python package so we recommend that you install that as well - this can be done similarly.

If you have any difficulties getting this code to run or have any questions feel free to get in touch with me at sdavenport(AT)ucsd.edu or via twitter @BrainStatsSam.