Next: Programming Scilab
Up: Operating with arrays as
Previous: Measuring curves
Contents
Usually, the measurement of an evoked response is the last step. The evoked potential has to be extracted from the raw electroencephalographic activity. To simulate this process we will act on `cleanvep' which will be masked by using `rand'.
If we invoke `rand' with the parameter `normal' it calculates values with a Gaussian distribution of mean `0' and variance `1'. Values obtained mostly span from -2 to +2 standard deviation, more or less from -2 to 2 uV. And if we multiply by `2', the noise signal that we are going to add will have a range of about 8 uV, more than double than `cleanvep'.
We have a matrix (`sweeps') containing in each row one trace. Extracting `cleanvep' is an easy task
-->cleanvep = 2 * (sin(%pi*[0:127]/128).^2) .* (cos(2*%pi*[0:127]/128));
-->cleanvep = [zeros(1,36), cleanvep,zeros(1,36)];
-->sweeps = cleanvep + 2 * rand (cleanvep,'normal');
-->// adds sweeps with noise
-->for k=1:299
--> noisevep = cleanvep + 2 * rand (cleanvep,'normal');
--> sweeps = [sweeps ; noisevep];
-->end;
-->// calculates average
-->meanvep = mean (sweeps, 'r');
-->// plots it with `cleanvep'
-->plot2d ([1:200;1:200]',[meanvep;cleanvep]')
This code has been written in a file and executed with `exec'. The result can be seen in figure 3.2.
Figure 3.2:
The extracted potential superimposed with `cleanvep'
 |
This way of calculating has some problems, being perhaps the worst of them the fact that it consumes a great amount of memory and, if we use this method to average a great amount of sweeps or a great number of channels, it could be not feasible. An alternative is maintaining a buffer and adding each sweep to it (something like an averager).
But the method we used has some advantages too: we can easily calculate a `median evoked potential'
-->medianvep = median (sweeps, 'r');
Median is less sensitive than mean to large values produced by artifacts. The cost to pay is that we need much more resources to obtain the graph. Some combinations of methods could be used (for instance to calculate the median for `n' traces and accumulate the result in a buffer) which would eliminate large isolated values produced by artifacts.
The process of averaging to extract low amplitude signals from noisy environments implies that the signals that we want to extract are constant and lined with the beginning of the vector. It is a general method widely used in clinical practice. We could use some variants of this technique
- We could average segments of the signal occurring prior to the trigger point (back averaging) to get the potentials generating some motor effect.
- We can extract some sweeps depending on whether or not a condition is satisfied. For instance, we could generate two different averages with two stimuli of similar but different characteristics after instructing the subject to discriminate between them. This can be done to detect late components related to the processing of the stimulus.
- We can average some curves that derive from others. For example, we could generate a heart rate trace by interpolating from R-R intervals of the electrocardiogram. Then we could average the trace by using any other pattern as a trigger (for instance, sleep spindles or K-complexes) to see whether or not there is some change in heart rate associated to them
- We can average not only different sweeps but potentials from different subjects too (something sometimes called `grand average'). For instance, if we compare visual evoked potentials in a group of persons suffering from a particular disease with a control group, we can represent not only the curves but also the significance level of differences against `0' for each point. If we maintain raw data, it is possible to use not only parametric tests but also non-parametric tests
- We can maintain different sub-averages for the same data; for instance `odd' and `even' traces to evaluate the consistency of the result.
The extraction of repetitive characteristics by averaging is a powerful technique. Until recently, the access to the raw signal has been limited by shortage of memory. Now, and probably even more in the future, we will be able to treat very long traces. To indicate points that have some characteristic and act as triggers, one efficient method is to maintain arrays of indexes which can be used as triggers in the process of averaging. We will dedicate more attention to indexes in coming sections.
Next: Programming Scilab
Up: Operating with arrays as
Previous: Measuring curves
Contents
j
2003-01-23