# [FieldTrip] cluster-based permutation test with linear mixed effects models

Ondrej Zika zika.ondra at gmail.com
Thu Nov 26 13:49:04 CET 2020

```Dear all,

I have a theoretical question about shuffling strategies in permutation
tests using linear mixed effects models.

I have created a minimal working example, so that you can refer to specific
points with code if necessary here: https://ozika.github.io/perm_test_lme/

Scenario 1:
(I just made these examples up, i tried to keep the dimensions unique in
size for identifiability)
Dependent variable (DV)

- pupil size (measured every second after onset, for 5 seconds)

Fixed effects

- background color (within subject, 2 levels)
- congruency (within subject, 2 levels)

Random effects

- participant (10 participants/levels)

Each participant completes 40 trials, 10 one of each kind in the 2x2
design. The overall DV dataset is therefore 400x5 matrix.

Analysis (code [here](https://github.com/ozika/perm_test_lme) to be
specific):
1) Run LMM for each data point using: pupil ~ bgcolor + congruency +
bgcolor*congruency + (1|sub)
2) Collect t-values
3) Identify clusters
4) Generate null distribution by shuffling labels of bgcolor and
congruency within
each subject. Include (?) permutations where no cluster was above the
threshold and assign them 0 cluster mass.
5) Calculate desired threshold based on the null distribution
6) Evaluate actual clusters for each effect.

---

Scenario 2:
Dependent variable (DV)

- pupil size (measured every second after onset, for 5 seconds)

Fixed effects

- background color (within subject, 2 levels)
- drug/placebo (between subject, 2 levels)

Random effects

- participant (10 participants/levels)

This is the same scenario as above but one factor is now a between subject
variable. Would the right randomization strategy be to shuffle bgcolor
within subject and then shuffle labels for entire subjects? (e.g. if each
sub has 100 sampels altogether, shuffle the entire blocks of 100)
Is there a disadvantage in shuffling ALL variables across all
samples/subjects?

Thank you for any comments that you might have!

Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201126/5d533e66/attachment.htm>
```