osl_dynamics.glm.permutation#
GLM Permutations base class.
Classes#
Base class for permutation tests. |
|
Max statistic permutation test. |
Module Contents#
- class osl_dynamics.glm.permutation.Permutation(design, contrast_indx, n_perm, perm_type=None, n_jobs=1)[source]#
Base class for permutation tests.
- Parameters:
design (osl_dynamics.glm.base.Design) – Design object.
contrast_indx (int) – Index of the contrast of interest.
n_perm (int) – Number of permutations.
perm_type (str, optional) – Type of permutation. Options are ‘sign_flip’ and ‘row_shuffle’. If None, it will be determined based on the feature types and contrast type.
n_jobs (int, optional) – Number of jobs to run in parallel.
- permute_X()[source]#
Permute the design matrix based on the perm_type.
- Returns:
X_copy – Permuted design matrix. Shape is
(n_samples, n_features).- Return type:
np.ndarray
- fit(y)[source]#
Fit the GLM with unpermuted data and run permutations.
- Parameters:
y (np.ndarray) – Target variable. Shape is
(n_samples, *target_dims).- Return type:
None
- class osl_dynamics.glm.permutation.MaxStatPermutation(design, contrast_indx, n_perm, perm_type=None, n_jobs=1)[source]#
Bases:
PermutationMax statistic permutation test.
- Parameters:
design (osl_dynamics.glm.base.Design) – Design object.
contrast_indx (int) – Index of the contrast of interest.
n_perm (int) – Number of permutations.
perm_type (str, optional) – Type of permutation. Options are ‘sign_flip’ and ‘row_shuffle’. If None, it will be determined based on the feature types and contrast type.
n_jobs (int, optional) – Number of jobs to run in parallel.