<p><span style="padding: 3px 10px; border-radius: 5px; color: #ffffff; font-weight: bold; display: inline-block; background-color: #ff0000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p></p><div dir="ltr"><div>Hey everybody, hey Christoph,</div><div><br></div><div>I believe, in this case the result of the standard deviation (SD) and root mean square (RMS) approach should be roughly the same (if not the same).</div><div>You are right, that the RMS computation makes no subtraction of the mean across channels as it would be the case for the standard deviation. However, if the mean is zero, then the difference of a value to the mean it&#39;s just the value itself (the mean of the signal evoked.data should be pretty close to zero). Thus, the results of the calculations should be equivalent. But I&#39;m open for discussion if this assumption is wrong.<br></div><div><br></div><div>A quick snipped to test this assumption:<br></div><div><br></div><div>D = np.random.normal(0, 1, 1000)</div><div>D.std()<br></div><div>0.9586524583070871</div><div><br></div><div>np.sqrt((D * D).mean())<br>0.9586667427413401</div><div><br></div><div>Roughly the same. The results should vary if you assume a mean != 0.</div><div><br></div><div>Best,</div><div>José<br></div><div><br></div></div><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Do., 23. Juli 2020 um 10:53 Uhr schrieb Christoph Huber-Huber &lt;<a href="mailto:christoph@huber-huber.at" target="_blank">christoph@huber-huber.at</a>&gt;:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)">        External Email - Use Caution        </span></p><p></p>Hi list,<div><br></div><div>I recently came across that mne python uses 3 different formulas for calculating global field power (GFP). I’m wondering why.</div><div>They are:</div><div><br></div><div>- The spatial standard deviation</div><div>line 1492 of /mne/viz/utils.py</div><div>gfp = evoked.data.std(axis=0)</div><div>This is the original version as e.g. in Lehmann &amp; Skrandies (1980) <a href="http://dx.doi.org/10.1016/0013-4694(80)90419-8" target="_blank">dx.doi.org/10.1016/0013-4694(80)90419-8</a></div><div>Note that the fieldtrip folks write about global field power “The naming implies a squared measure but this is not the case.” (see help text of the FT_GLOBALMEANFIELD function of the fieldtrip toolbox).</div><div><br></div><div>- Root mean square</div><div>line 2988 of /mne/viz/utils.py</div><div>combine_dict[&#39;gfp&#39;] = lambda data: np.sqrt((data ** 2).mean(axis=1))</div><div>There is no subtraction of the mean across channels as would be the case for standard deviation.</div><div><br></div><div>- Again, root mean square</div><div>line 466 of /mne/viz/evoked.py</div><div>this_gfp = np.sqrt((D * D).mean(axis=0))<br><br>- Sum of squares</div><div>line 131 of /examples/time_frequency/plot_time_frequency_global_field_power.py</div><div>gfp = np.sum(average.data ** 2, axis=0)<br>Here, we’re dealing with power values of a time-frequency decomposition, so that’s perhaps the reason for the missing mean and sqrt?</div><div><br></div><div>The mne python glossary at /doc/glossary.rst describes GFP as “the standard deviation of the sensor values at each time point”, consistent with Lehmann &amp; Skrandies. That seems to be correct only for the first formula mentioned here.</div><div><br></div><div>Any suggestions for the reasons of when to use which version and educated guesses of whether these differences matter in practice are highly welcome.</div><div><br></div><div>Thank you very much,</div><div>Christoph</div></div>_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a></blockquote></div></div>