Permute Labels in a Design for Permutation Testing
Source:R/permutation_searchlight.R
permute_labels.RdReturns a copy of design in which the link between the brain data
and the quantity being decoded or modelled has been broken by a random
relabelling that respects the design's block structure. This is the
null-generating step of run_permutation_searchlight.
Usage
permute_labels(
design,
method = c("within_block", "circular_shift", "global"),
seed = NULL
)
# Default S3 method
permute_labels(
design,
method = c("within_block", "circular_shift", "global"),
seed = NULL
)
# S3 method for class 'mvpa_design'
permute_labels(
design,
method = c("within_block", "circular_shift", "global"),
seed = NULL
)
# S3 method for class 'rsa_design'
permute_labels(
design,
method = c("within_block", "circular_shift", "global"),
seed = NULL
)
# S3 method for class 'pair_rsa_design'
permute_labels(
design,
method = c("within_block", "circular_shift", "global"),
seed = NULL
)Details
The generic dispatches on the design class:
mvpa_designShuffles trial labels:
y_train,cv_labels, andtargetsare replaced by permuted versions.block_varis never permuted.rsa_designPermutes item labels, not RDM entries. The entries of an RDM are not independent observations: every item takes part in
n - 1pairs, so shuffling the vectorised RDM would destroy that dependence and give an anti-conservative null. Relabelling items keeps it intact. The permutation is stored on the design asitem_perm;train_model.rsa_modelapplies it to the rows of the neural pattern matrix before the brain RDM is computed. That is equivalent to permuting the rows and columns of every model RDM by the inverse permutation, so the model matrix and any cached kernel stay untouched.pair_rsa_designAs
rsa_designin within-domain mode. Forpairs = "between"the two item sets are permuted independently, each within its own blocks (block_var_a,block_var_b), and the second permutation is stored asitem_perm_b.
RSA item permutations break the brain's association with all
design predictors, including nuisance predictors. For regression with
multiple predictors they generate a joint no-association null, not a null
for an individual coefficient conditional on the other predictors. See
the rsa_null setting in permutation_control.
Circular shifts sample every rotation, including zero, independently in each block. Identity draws and draws that move only some blocks belong to the null distribution and are retained.
When an RSA design excludes within-block pairs (the default whenever a
block_var is supplied and some pairs fall within a block), items are
exchangeable only within a block, and method = "global" is refused:
the null would compare neural patterns from the same run while the observed
statistic never does. If every block holds a single item, no within-block
shuffle can move anything and the method errors; when no pairs are excluded
in that situation, method = "global" is the valid choice.