Hi all,
I am using the ERDS tutorial and trying to translate it to get a group statistic instead, though, I am not completely sure how to do it. I am guessing that just like other group ERP like analyses I want to create a group variable the stores each participant’s tfr that gets fed into the pcluster_test. Could anyone help me understand where to feed that into and if i need to do something to each participant first? starting from the fifth cell in the tutorial at Compute and visualize ERDS maps — MNE 1.4.2 documentation
I have added in a tfr_par that houses each participant’s tfr. I am just not sure how to plug that into the pcluster_test() and if I need to do something like first take the averages from each participant and then move forward with those as inputs to that test.
tfr_par=[ ]
for par in epochs:
tfr = tfr_multitaper(
par,
freqs=freqs,
n_cycles=freqs,
use_fft=True,
return_itc=False,
average=False,
decim=2,)
tfr.crop(tmin, tmax).apply_baseline(baseline, mode="percent")
event_ids=par.event_id
tfr_par.append(tfr)
for event in event_ids:
# select desired epochs for visualization
tfr_ev = tfr[event]
fig, axes = plt.subplots(
1, 5, figsize=(12, 5), gridspec_kw={"width_ratios": [10, 10, 10, 10, 1]}
)
for ch, ax in enumerate(axes[:-1]): # for each channel
# positive clusters
_, c1, p1, _ = pcluster_test(tfr_ev.data[:, ch], tail=1, **kwargs)
# negative clusters
_, c2, p2, _ = pcluster_test(tfr_ev.data[:, ch], tail=-1, **kwargs)
# note that we keep clusters with p <= 0.05 from the combined clusters
# of two independent tests; in this example, we do not correct for
# these two comparisons
c = np.stack(c1 + c2, axis=2) # combined clusters
p = np.concatenate((p1, p2)) # combined p-values
mask = c[..., p <= 0.05].any(axis=-1)