lmmresample: Resampling inference for mixed models of pupillometry and other trial-structured physiological signals. A tutorial
Abstract
Continuous physiological signals such as pupil size, EEG, skin conductance and heart rate are often analysed with linear mixed-effects models (LMMs) of the complete time series. Because consecutive samples are strongly autocorrelated, the usual Wald and Satterthwaite tests treat them as nearly independent and overstate the evidence. We present lmmresample, an R package that keeps the researcher's LMM and replaces its inference with permutation tests and bootstrap confidence intervals that resample whole trials and participants, so that the dependence within trials is carried into the reference distribution without being modelled. The package also corrects for multiple tests and post hoc comparisons, and includes diagnostics that check the model fit, quantify the dependence and calibrate the tests for the user's design. In simulations resembling pupillometry data, Wald and Satterthwaite tests of condition × time interactions gave 46–83% false positives, and their 95% intervals covered the true value in 57–68% of data sets. The permutation test held the nominal level (2–7%) in every scenario, and bootstrap intervals covered 91–96%. A tutorial with public pupillometry data shows a complete workflow, including an analysis in which Wald, Satterthwaite and GAMM tests indicated an effect that methods controlling the error rate did not support. For continuous signals analysed with mixed models, lmmresample gives p-values and confidence intervals that keep their nominal error rate and coverage. The dependence between samples does not have to be specified, no complex random-effects structure has to be fitted, and power matched the best valid alternative.
Related
- SHERLOCK: Structured representation learning and causal inference of downstream perturbation effects
- Observed Interpersonal Physiological Synchrony Is Not Interpersonal Coupling: Identification Depends on the Observation, Design, and Inference Pipeline
- PINN-based functional inference in size-structured population models: Application to fish oogenesis
- ssGSEA3.0: Feature-Level Bootstrap Resampling for Robust Assessment of Statistical Significance
- Optimising Analysis Choices for Multivariate Decoding: Creating Pseudotrials Using Trial Averaging and Resampling
BibTeX
@misc{flores2026lmmresample,
title = {{lmmresample: Resampling inference for mixed models of pupillometry and other trial-structured physiological signals. A tutorial}},
author = {Ricardo Martínez Flores and Hams Super},
howpublished = {PsyArXiv},
year = {2026},
month = nov,
doi = {10.31234/osf.io/je35k_v1},
url = {https://osf.io/preprints/psyarxiv/je35k_v1/},
note = {CC BY 4.0},
}
RIS
TY - UNPB
TI - lmmresample: Resampling inference for mixed models of pupillometry and other trial-structured physiological signals. A tutorial
AU - Ricardo Martínez Flores
AU - Hams Super
PY - 2026
DA - 2026/11/20
PB - PsyArXiv
DO - 10.31234/osf.io/je35k_v1
UR - https://osf.io/preprints/psyarxiv/je35k_v1/
AB - Continuous physiological signals such as pupil size, EEG, skin conductance and heart rate are often analysed with linear mixed-effects models (LMMs) of the complete time series. Because consecutive samples are strongly autocorrelated, the usual Wald and Satterthwaite tests treat them as nearly independent and overstate the evidence. We present lmmresample, an R package that keeps the researcher's LMM and replaces its inference with permutation tests and bootstrap confidence intervals that resample whole trials and participants, so that the dependence within trials is carried into the reference distribution without being modelled. The package also corrects for multiple tests and post hoc comparisons, and includes diagnostics that check the model fit, quantify the dependence and calibrate the tests for the user's design. In simulations resembling pupillometry data, Wald and Satterthwaite tests of condition × time interactions gave 46–83% false positives, and their 95% intervals covered the true value in 57–68% of data sets. The permutation test held the nominal level (2–7%) in every scenario, and bootstrap intervals covered 91–96%. A tutorial with public pupillometry data shows a complete workflow, including an analysis in which Wald, Satterthwaite and GAMM tests indicated an effect that methods controlling the error rate did not support. For continuous signals analysed with mixed models, lmmresample gives p-values and confidence intervals that keep their nominal error rate and coverage. The dependence between samples does not have to be specified, no complex random-effects structure has to be fitted, and power matched the best valid alternative.
ER -