# [Eeglablist] Manual ERSP averaging of single trials vs. newtimef averaging

Marius Klug marius.s.klug at gmail.com
Thu Jun 29 15:18:09 PDT 2017

```Dear list,

I have computed single trial ERSPs for all epochs of my data sets and want
to manually do the averaging. The reason for this is that we use
timewarping which is impossible in the STUDY GUI, so we have to do it
manually, plus it generally gives full flexibility, once everything is
computed. I save each ERSP and the respective epoch information about
conditions etc, such that I can then later manually play around with
everything and generate average ERSPs to my needs.

Now I have seen that the average of all single ERSPs is not the same as if
I let newtimef compute all of them at once (manually computing single
trials also takes WAY longer btw). I did a little bit of reading and
checked the newtimef function and understood that the final ERSP plots are
in dB values, but they are internally averaged in power values. So I
transformed the single trials back to power values and averaged them, then
transformed into dB space again. However, I still find small differences in
the plot for the two epochs. My final averaging ERSP of all epochs with
this procedure looks rather strange, so I suspect some error summing up
over many trials.

I have created a Dropbox folder providing you with two plots and a script
to generate them:
https://www.dropbox.com/sh/vkc6onv9r2oqr58/AAA8ZpH8Jzrq45hF4yos5ZfFa?dl=0

Plot_figures loads the data and creates two figures with subplots:

> Figure 1: The grand ERSPs of two experiment conditions, once created by
dB averaging, and once by power averaging.

> Figure 2: An example with two epochs. The single trial epoch ERSPs
alongside the newtimef averaged ERSP, the power averaged ERSP, and the dB
averaged ERSP. I can't show the ground truth (newtimef averaging) here,
since if I had it, this procedure would not be necessary...

Can someone help me out here? What am I missing? Any help or hint where in
the newtimef function to look exactly would be appreciated!

Regards,
Marius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20170630/572cae43/attachment.html>
```