Owner LaBGAS Folder firstlevel/ Depends on SPM12, CanlabCore

The first level fits a general linear model to each subject’s preprocessed time series, and produces the contrast images that group analysis consumes.

What this stage produces

  • A specified and estimated SPM design per subject and model
  • Contrast images, one set per subject, named consistently across the cohort
  • Diagnostic reports for quality control before anything reaches the group level

Design specification

The design is built from the event timing files created during prep together with fMRIPrep’s confound regressors. Decisions that matter here:

  • Which conditions are modelled, and which are collapsed
  • Which confounds enter the model — motion parameters, aCompCor components, framewise displacement, cosine drift terms. fMRIPrep offers far more than any single model should use; choose a defensible strategy and apply it uniformly across subjects
  • High-pass filtering and autocorrelation modelling
  • Whether runs are concatenated or modelled separately with run regressors

The model definition is study-specific, so this is expected to be adapted. Keep it in the study’s own repository so the choices are versioned alongside the results they produced.

Estimation

Estimation is SPM’s, driven from the LaBGAScore scripts so that the same model can be applied across the cohort without hand-editing batch files per subject.

Contrasts are specified once, centrally, and applied to every subject — consistent contrast naming is what makes the second-level scripts able to find images automatically. Renaming a contrast midway through a cohort is a reliable way to lose an afternoon.

Diagnostics

Run diagnostics before group analysis, not after a result looks odd. Worth inspecting:

  • Design matrix — collinearity between regressors, particularly between conditions of interest and motion
  • Model fit — residual structure, variance explained
  • Motion — per-subject summaries, and an explicit, pre-registered exclusion rule applied uniformly
  • Contrast images — visual inspection for coverage dropout, especially in ventral regions, which matters for the gut-brain circuitry we study

CanlabCore’s fmri_data methods are useful here — see the CANlab object documentation and the quality-control material in the walkthroughs.

CANlab equivalents. CanlabCore has its own first-level machinery, including the fmri_model object and canlab_glm_* batch tools, documented at canlab.github.io/docs. LaBGAScore’s first-level scripts wrap SPM directly to fit our BIDS/fMRIPrep conventions, then hand off to CANlab objects from the second level onward.

Handing off to the group level

The second-level scripts expect to find contrast images in a predictable location with predictable names. Getting that right at the first level is what makes second-level analysis close to configuration-only.


Next: Second-level analysis Source: firstlevel/

Updated: