Sandwich Estimator Toolbox for Longitudinal & Repeated Measures Data

A toolbox for SPM

By Bryan Guillaume & Thomas Nichols


This page...
FMRI worked example


The SwE toolbox is a toolbox for longitudinal and repeated measures neuroimaging data. It fits a simple "marginal model" with no need for per-subject dummy variables, and instead of iterative computation of variance components it uses the noniterative "sandwich estimator" to find standard errors.

The core work is described in Guillaume et al. (2014), with improved small sample adjustments as well as a Wild Bootstrap for non-parametric inferences covered in Guillaume & Nichols (2015) and Guillaume (2015).

It is implemented as a Matlab toolbox for SPM12.

For the SwE manual click here. To download SwE click here. Alternatively, check GitHub for history and latest version: SwE Repo.

Why use SwE?

This approach has a number of advantages over traditional linear mixed effect models:

  • Easy random effects

    Only the population model is specified, meaning that no random effects (e.g. random slopes) need to be specified.

    • Despite having no explicit specification, all possible random effects are accounted for through the use of an unstructured error covariance.
    • For moderate sample sizes, the "Hom"ogeneous sandwich estimator assumes each subject in a group shares the same visit-based covariance structure.
    • For large sample sizes, the "Het"ergoeneous (traditional) sandwich estimator doesn't even assume common covariance over subjects.
    • When comparing multiple groups, each group automatically has its own covariance structure.
    • Different from usual approaches in SPM and FSL, it doesn't require per-subject dummy variables, and so allows between-subject covariates like age and sex.
    • There is no need to have a balanced design, and in fact, singleton subjects can be modeled along with subjects with multiple measures.

  • No convergence problems

    The population model is estimated with Ordinary Least Squares, meaning that the method is non-iterative and thus is immune to convergence failures not uncommon in complex mixed effects models.

  • Built for neuroimaging

    • Toolbox for widely used SPM software
    • While the traditional sandwich estimator techniques often assume large samples, SwE implements carefully evaluated (and in some cases novel) degrees of freedom estimator and small sample adjustments.
    • Familywise error-corrected voxel and cluster inferences are available with the Wild Bootstrap, avoiding any parametric (e.g. random field theory) distributional assumptions.



If you have further questions please start by searching the "SwE-Toolbox Support" Google Groups messages, and then send a message to the group: swe-toolbox@googlegroups.com.

For further queries or to report any issues please contact Bryan Guillaume & Thomas Nichols.