Does AFNI have support for LS2-style single-trial modeling?

Hi AFNI team,

I’m currently using 3dLSS for beta-series estimation and understand that it implements the LS1 approach as described in Mumford et al. (2012), where each GLM includes one regressor for the trial of interest and another for all remaining trials.

I was wondering if AFNI currently supports (or has plans to support) the LS2 variant described in their follow up paper Turner et al. (2012) — where each GLM includes three regressors:

  1. The current trial
  2. All other trials of the same condition/type
  3. All trials of other types

This model helps improve estimation by more precisely modeling nuisance variance from within-condition and between-condition sources.

Does any existing AFNI program implement this LS2 structure? Or is there a recommended workaround (e.g., using 3dLSS) to simulate this trial-wise approach manually?

Thanks in advance for your guidance,
Sahithyan

Hi Sahithyan,

If I understand the context correctly, it seems you might be able to use 3dLSS directly to implement the LS2 method with minimal additional effort.

For example, suppose you have two task conditions. To obtain the model matrix (used for 3dLSS) for trial-level estimates of task condition 1, you could specify the 3dDeconvolve script as follows:

3dDeconvolve ...          \  
   -num_stimts 2          \  
   -stim_times_IM 1 ...   \  
   -stim_times 2 ...      \  
   ...  

Likewise, to obtain the model matrix of trial-level estimates for task condition 2, you could reverse the roles of the two conditions:

3dDeconvolve ...          \  
   -num_stimts 2          \  
   -stim_times 1 ...      \  
   -stim_times_IM 2 ...   \  
   ...  

Do you think this approach might work for your case?

Gang Chen

Hi @Gang

Interesting. I didn’t think of that.

Just to confirm - I understanding this correctly

I should generate a separate model matrix for each condition (e.g., stim1 and stim2), and then run 3dLSS twice—once with each matrix—to obtain trial-level estimates for each condition separately.

Is that right?

-Sahithyan

Yes, that’s precisely what I meant. Let us know if it works on your end.

Gang Chen

Awesome ! Thank you

It worked perfectly.

Thanks,
-Sahithyan