Bayesian multilevel modeling using brms

Hi Gang Chen !

I have a specific question about the population-level analysis performed in your paper paper

I have a similar within subject design (2 Reward * 3 Emotion) and I want to perform a Trial-Level-Modeling using brms.

I have performed the participant level analysis modifying the script provided here ([tlm/participant-level analysis at master · afni-gangc/tlm · GitHub])

I am trying to perform the population level analysis and need help understanding how to do the trial level modeling (without RT). I went through your code. I am not familiar with R and I am unable to understand the input data structure.

Can you help me understand the input data structure of the task including the how the header detail need to be provided?

And is it also possible for you to upload the input files used in the population analysis for the above mentioned paper (file name : 'RT-task-data.txt' or ‘task-data.txt’)

Thanks, and regards,


The paper you referred to aims to explore the extent and impact of cross-trial variability in a typical fMRI dataset. To better understand your study, could you clarify the following:

  1. Are you interested in cross-trial variability?
  2. What is your research hypothesis for the 2 × 3 experimental design?
  3. How many trials are there per condition?
  4. Are you planning to perform the population-level analysis at the voxel level or the region level?

Gang Chen

Hi Gang !

I am working with Srikanth Padmala to understand the cross-trial variability in our dataset.

To answer your question:

  1. Yes, we feel cross trial variability is something good to look at in our dataset.
  2. So, we are interested in understanding the interaction in our 2 × 3 experimental design. We have 2 Reward (High, Low) x 3 Emotion (Positive, Neutral, Negative).
  3. I have 24 trials per condition. Is that too low? But I have 60 subject data.
  4. For now, I am looking at performing the population-level analysis at the ROI level



The header for the ROI data should look like this:

subjID  ROI  Reward  Emotion  trial  beta  SE

Please note that the estimates for the BOLD response might be significantly biased (e.g., underestimated) because the adopted HRF is likely not well accommodative for some regions.

Gang Chen

Thank you! Can you also clarify some questions I have:

How do I get the SE values that you have mentioned in the above header.

I understand I can get the beta values using -Rbeta option.

How will I get the SE using -Rbuck ?

Second question, Can I perform the same REMLfit at the voxel level for the wholeBrain ?

  • Sahithyan


How will I get the SE using -Rbuck ?

You can add -tout in your 3dREMLfit script to obtain the t-statistics that are associated with the estimated regression coefficients from -Rbuck. Then the standard errors can be obtained through the following formula

Can I perform the same REMLfit at the voxel level for the wholeBrain ?

Sure. However, it would be computationally challenging if you plan to implement the Bayesian multilevel modeling approach at the voxel level.

Gang Chen