Calculate the RMS of the selected time window

Dear Brainstorm users,

I have a problem about calculate the RMS(root mean square) of the selected time window using BST in the source level. Hope brainstorm users can give me some suggestions. Here are details about my problems.

In the Average --> Average time selection, I can calculate the average amplitude of selected time window, but if I want to calculate the RMS of selected time window, how to do it in the BST?

I also have a question about the difference between the mean(abs(At1+At2+…+Atn)) and the sqrt(mean(Ati.^2)), Ati means the amplitude of i timepoint. Each of these can represent the average of the amplitude, but I saw some papers use RMS, but the BST use the average of absolute value.

Thanks in advance

Hi there Zhaowei,

There isn’t a specific process to do this in Brainstorm at the moment, as you’ve seen, the Average Time process only supports mean and standard deviation. You may do this instead from the Run matlab command process: http://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#Custom_processing

Cheers,
Martin

Thank you Martin!
I am trying to use the running the matlab command to achieve my goal.
One more question~
What is the difference between the mean of the absolute value and the RMS from application perspective.

BR,
Zhaowei

I cannot comment on their usage in the literature, but here are their differences from a statistical standpoint: https://medium.com/human-in-a-machine-world/mae-and-rmse-which-metric-is-better-e60ac3bde13d

Thanks you very much!
:smile:

About your RMS question: is this for computing over time in a given time window?
As the signals are oscillating around zero (before the absolute value), it can be easier to interpret the power of these oscillations in a frequency band of interest (PSD or time-frequency analysis).

Hi Francois, thanks for attention.

Yes, I am computing RMS over 100ms in a given time window from the stimulus onset to the end of my interested time point in the source level. Because I want to know which brain areas are significantly activate and when did this difference happen by doing the pair-t test of the RMS values at different vertices between conditions. The RMS can be replaced by mean of absolute value also. But I don’t know which way is better. That why I come up with this problems.