I would like to calculate the grand mean and the standard error across
subjects for each of my conditions. Is there a specific function in mne to
do it starting from each subject's EvokedArray ?
Let?s say you have a list of evokeds - evokeds. To get SEM you can do the
following:
import numpy as npfrom scipy.stats import sem
sem_data = sem(np.stack([x.data for x in evokeds], axis=2), axis=2)
Now sem_data is an array of size (n_channels, n_samples). To get the lower
bound of the SEM you would have to subtract sem_data form the data of your
grand average and add it to get the upper bound.
?
2016-08-24 12:23 GMT+02:00 Emanuela Liaci <emanuela.liaci at gmail.com>:
thanks for your response. So I tried what you suggested me, by creating a
list of evokeds (here printed the list for one condition and just 2
subjects: [<Evoked | comment : 'Unknown', kind : average, time :
[-0.060000, 0.798000], n_epochs : 48, n_channels x n_times : 32 x 430, ~177
0.798000], n_epochs : 50, n_channels x n_times : 32 x 430, ~177 kB>]).
When I do: sem_data = sem(np.stack([x.data for x in evokeds], axis=2),
axis=2), I get this error: AttributeError: 'module' object has no attribute
'stack'
np.stack was added in numpy version 1.10.0 - your numpy is most likely
older (you can check what you get from np.__version__).
But you can use np.dstack instead of np.stack(..., axis=2) - it will work
on older numpy versions.
So, try:
sem_data = sem(np.dstack([x.data for x in evokeds]), axis=2)
?
2016-08-25 10:44 GMT+02:00 Emanuela Liaci <emanuela.liaci at gmail.com>: