averaging across subject

Commands: mergeavgfiles, mergeavgfilegroups, calcavgdiff, FileMan.

Averages across a sample of subjects are often referred to as 'Grand Means' or 'Grand Averages'. They usually look much nicer (smoother) than evoked responses from a single subject and represent to a greater extent than a single subject average the 'typical' brain response evoked by the corresponding stimulus. Grand Means are most useful for getting an overall impression about the effect of your experimental manipulation, although they do not give you any information about its statistical significance.

Grand Means in EMEGS are calculated using the SCADS file format, which is the default format for all evoked signals in EMEGS. It is, other than for instance the '*.avr'-format used by BESA, a binary format and you can only look at it with the help of a special viewer (like emegs2d and emegs3d). Files in this format are usually labelled using the 'at'-extension , which stands for 'average in time', followed by the condition name (usually a number) The filenames ofEEG-data-files, that have been rereferenced using an average reference, additionally are appended  '.ar' for 'average reference'. Thus a typical filename for condition 1 in your experiment could be 'yourexperiment.at1.ar'.

Averaging across subjects can be done using the matlab command line or using the file managing module ('FileMan'). Both ways will be described in the following:

averaging using the command line: The command for the calculation of one Grand Mean is 'mergeavgfiles'. Type it in and hit return. You are then prompted with a 'file-open'-dialog where you can select a series of SCADS files (by double clicking on each file one after the other) or load a batchfile, that contains a list of the filepaths of the SCADS files, that you wish to average (usually one per subject). EMEGS tests the first file you select for binary information. If only character information is found, EMEGS assumes you are using a batchfile and now checks all the paths in the file for existence. If successful, you are prompted to enter additional options in the command window (see below)  If binary information is found, EMEGS assumes you are selecting datafiles and the dialog reappears for you to select additional data files. When you are done selecting data files, push 'cancel' and go on entering the remaining options in the command window:

The first option concernes the relative wheighting of the SCADS files, that will enter the averaging:

Do you want to use
no weighting                    [1]
trial number weighting      [2]
Std matrix weighting        [3]

(The default value is [2] !)

The default answer which you can choose by simply hitting return is weighting the aveages using the number of trials that entered into each subject average. This usually makes sense, as it can be presumed that the number of good trials does not vary radically over subjects and, moreover, is an index of the data quality and the signal-to-noise-ratio in each subject average. Thus files with high signal-to-noise are weighted heavier than files with low signal-to-noise.
The next option concernes normalization of the data. This scales the data so that the mean and variance in every subject average are approximately constant. This can be useful if you are not interested in the differences between subjects, but in general, you would leave the data unchanged and select no normalization (the default). Again you can do this by just hitting return.

Do you want to use
no normalization                            [1]
Norm=mean(mean(sqrt(Data.^2)))    [2]
Norm=mean(mean(Data.^2))            [3]
Norm=mean(mean(Data))                [4]

(The default value is [1] !)

After that, you are asked wether you wish to calculate a baseline. Most of the time, this is a good idea, so just hit return.

Calculate a baseline ?

Please insert your choice  Y/N [Y] :

Then you have specifiy, over which points the baseline should be calculated...

Do you want to use
the whole interval as baseline ?

Please insert your choice  Y/N [N] :

In most cases, you do not use the whole intervall but will select a set of points at the beginning of each epoch, explicitly dedicated to the baseline calculation. If this is the case, you can just hit return to set the first point that is included in the baseline calculation to the first point in the averaged signal (== point 1). The end point however will be different for every type of presentation/experiment you are running. It usually equals the number of points you extractet from the continuous data before each trigger (the 'PreTrig'-value in PrePro). For an analysis with a sampling rate of 250Hz where 100ms were extracted before every trigger, the baseline end point would be 25 (100ms * 250 / 1000 ) .

Please insert the baseline start point:
(The default value is [1] !)

Please insert the baseline end point:
(The default value is [1] !)

Last, you can choose wether you want a display of the global power for every subject average that goes into the Grand Mean. If you choose 'Y', a figure will be displayed with one axis for every subject average, displaying its Global Power.

Print Global Power
for each file ?

Please insert your choice  Y/N [Y] :

Then you are given a 'save file'-dialog to name the calculated GrandMean file. EMEGS suggests a name, but you can change this to any name you like. After you push the 'save'-button, EMEGS starts the averaging, displayes the global power overview and, when done, prints the path of the GrandMean in the command window!

averaging using the FileManager: