# What is averaging and how can it be done?

I'm studying about the analysis of (mainly) fMRI and EEG data. Multiple times it's mentioned that to reduce noise, you can use averaging, but nothing more detailed than that.

There never is literally stated that you can use this or that technique to average. So, what exactly is averaging? What techniques can be used to achieve it?

In general, EEG, fMRI (and also MEG, SPECT and PET datasets -the so called "functional modalities") are obtained from a subject (e.g. a human being) while it is engaged in one or more "activities".

This "activity" could even be "Stay at rest with your eyes closed" or "try to solve this equation" or "simply look at the images on this screen".

Usually, more than one subjects will be engaged in a study and these subjects may be divided into groups according to some criterion to compare and contrast their responses (e.g. "Controls" (subjects that are "normal" or do not suffer from a disease) and "Diseased" (subjects that have been verified to suffer from some disease)).

Both of these modalities, in addition to sampling time they also sample space AND each fMRI / EEG dataset is itself a sample from a population of subjects mentioned above.

Having described this, you can almost see the dimensions across which you would apply averaging and why:

1. You can do (the common) temporal averaging (like a moving average or median filter) over each channel (for the EEG) or voxel time series (for fMRI) to reduce the effect of noise.

2. You can do Spatial averaging in a number of different ways and for different purposes but all that spatial averaging entails is summing together the responses from $N$ individual channels ($N$ individual vectors) and diving them by $N$ to get a mean response.

For example, perhaps you would like to obtain the average response corresponding to some brain region (occipital, parietal, frontal, other). Then you can select the $N$ vectors (channels) corresponding to those regions and obtain ONE vector by averaging them (for example, if your channels are in X(channelN, timeSampleM) you can obtain ONE average by doing mean(X) which will return one vector of size 1 x timeSampleM with the mean of each column (that corresponds to the sample taken by each channel at some time instant $M$).

Another thing you might want to do, is obtain the average response of ONE subject depending on the activity they were carrying out. For example, you would like to see the differences in the average response of a subject's brain between the conditions of REST and LISTENINGTOMUSIC. In this case, you need to know which datasets correspond to which activity and you simply obtain the average of those $X_{k,l}$ (where $k$ denotes the dataset and $l$ denotes the activity).

3. You can do spatial averaging over a population (and / or "activity" they were carrying out). So for example, you might want to see what is the average response of the brain at condition REST between two subject groups (Group A, Group B). In this case you select all datasets from all subjects in Group A and obtain an average dataset and similarly for Group B. You can do the same (but changing the membership) to obtain the average response of ONE group between different conditions.

(And of course, you could apply any combination of spatial / temporal / group / condition averaging depending on what you are trying to observe)

Finally, another area where averaging is inherent to the data processing is that of Evoked Potentials.

For example, imagine that you would like to examine the response of the brain to a burst of audible noise. In this case, you provide a stimulus to the subject and record its response for a number of times. After that, you average all recordings (alligned at the stimulus instance) and produce ONE signal that represents the response of the brain. A famous such signal is the P300.

As you can see, although the operation of averaging is the same (from a mathematical point of view) there are many different ways to apply it depending on the objective. Therefore, I would recommend going over a specific paper carefully to understand

• a) why they apply averaging
• and b) how is averaging applied.

Furthermore, i would like to recommend to you the following resources that you might find useful and which cotain far more detailed information about EEG and fMRI analysis (incudling averaging) in general: