How are trials combined within a block/condition?

157 views
Skip to first unread message

Shannon Lim

unread,
Oct 5, 2020, 8:43:28 PM10/5/20
to Homer-fNIRS and AtlasViewer Community
When using Homer, are the beta values for each trial simply averaged across the condition to provide an average HRF for the condition?

My task: 1 condition with 5 trials.

I attempted to test this out by comparing the output from coding each trial as one condition (see StimGUI image 1Condition.png) versus the average output of coding each trial as separate conditions (see StimGUI image 5Conditions.png) on the same dataset.

The results were not the same (see AvgComparisons.png image). Black lines are the calculated average processing the data as 5 conditions, Red lines are the outputs from processing the data as 1 condition. Solid lines are HbO, doted lines are HbR.

Can someone tell me how trials are combined within a single condition?

Thanks!
Shannon
5conditions.png
1Condition.png
AvgComparisons.png

Sergio Novi

unread,
Oct 6, 2020, 7:20:34 AM10/6/20
to homer...@googlegroups.com
Hi Shannon, 
 
"When using Homer, are the beta values for each trial simply averaged across the condition to provide an average HRF for the condition?"  

It depends on the method that you are using to compute the hrf. For example, if you are using the "hmrBlockAvg.m" function, it will set the baseline to zero of each trial then average the hemoglobin time series across all trials. There is no estimation of beta-values since this method does not assume any model. 

"Can someone tell me how trials are combined within a single condition?"  

 I will try to explain it with an example.  For this example, let us assume that the pre-time and pos-time are equal to 2s and 20s, respectively.

For the case of block averages and for a given channel the algorithm is basically:

1 - Segment the Hb time series around the triggers. The script will segment the Hb time series from 2 seconds prior to each trigger to 20 seconds after each trigger. If you have 5 trials, you will end up with 5 different segments for each Hb.  

2 - Set the baseline of each segment to zero. For each segment, you have to subtract the average of the first 2 seconds.

3 -After setting the baseline of each segment to zero, you can just average across all segments.  

I hope it helps. 
Best, 
Sergio 



--
You received this message because you are subscribed to the Google Groups "Homer-fNIRS and AtlasViewer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to homer-fnirs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/homer-fnirs/057ab8b3-2105-4cc5-af0e-5ad5e250ec42o%40googlegroups.com.

shann...@gmail.com

unread,
Oct 6, 2020, 12:00:43 PM10/6/20
to Homer-fNIRS and AtlasViewer Community
Thanks Sergio!
That helps alot. I got the exact same values after zeroing each output to their corresponding mean baseline value. I suppose this also means that comparisons between different conditions should also be zeroed to their respective baselines before comparing conditions. Is this correct?

Shannon

Sergio Novi

unread,
Oct 15, 2020, 8:13:05 AM10/15/20
to homer...@googlegroups.com
Hi Shannon, 
sorry for my late reply, I think that it is correct. 
Best, 
Sérgio



alvin...@gmail.com

unread,
Nov 4, 2020, 8:55:44 PM11/4/20
to Homer-fNIRS and AtlasViewer Community
Hi Sergio, 


I have a few questions about the block average. How does block average works when the trials are of unequal length .i.e unequal observations? 
Do we get to specify the length of each trial for averaging? 

Thanking You, 
-Anil

Sergio Novi

unread,
Nov 5, 2020, 6:59:47 AM11/5/20
to homer...@googlegroups.com
Hi Anil, 
from my understanding, this is one of the limitations of the "classic" block average procedure. 
In these situations, I think that you have two options. 

The first option is to segment each trial into a fixed number of segments then you can average each segment across trials and even volunteers ( I am not sure if this option is implemented in Homer). For example, suppose that you have 2 trials in which the first trial lasted for 20 seconds and the second for 30 seconds. You could segment each trial into 10 parts. Each segment would have 2 and 3 seconds for the first and second trials, respectively. I think that if one block is not much longer than the other ones, this procedure is fine. (note that my example is a little bit extreme)

The second option would be to use a GLM model instead of the block average. I personally prefer to use GLM models. In this situation, you would just have to properly create the design matrix by convolving your expected hrf with boxcars. Each boxcar should have the size of each stim duration.  If you have short-channel measurements, you can also include them in the design matrix. 

Best, 
Sérgio


Boas, David

unread,
Nov 6, 2020, 8:04:33 AM11/6/20
to homer...@googlegroups.com

The GLM in Homer3 will very soon properly handle trials of different lengths as you can include stim duration and amplitude for each stim onset in stimGUI

We hope to have this posted to github this coming week or next.

Reply all
Reply to author
Forward
0 new messages