Reviewer #2 (Public review):
The paper presents a regression-based approach for analysing fiber photometry data termed Concurrent Functional Mixed Models (cFLMMs). The approach works by fitting linear mixed effect models separately to each time point in trial aligned data, then applying smoothing to the model coefficients (betas), and computing confidence intervals. The method extends the authors previous work on using FLMMs for photometry data analysis by allowing for the inclusion of predictors whose value changes across timepoints within a trial, rather than just from trial to trial. As fiber photometry is a rapidly expanding field, developing principled methods to analyse photometry data is valuable, particularly as the authors have released an R package that implements their method to facilitate their use by other groups. The basic FLMM approach for using mixed effects models to analyse trial aligned photometry data, detailed by the authors in their previous manuscript (Loewinger et al. 2025, doi: 10.7554/eLife.95802) appears valuable. The aim of incorporating variables that change within trial into this framework is interesting, and the technical implementation appears to be rigorous. However, I have some reservations as to whether the way in which variables that change within trial have been integrated into the analysis framework is likely to be widely useful, and hence how impactful the additional functionality of cFLMM relative to the previously published FLMM will be.
In the original FLMM approach, where predictors change only from trial-to-trial, fitting separate regressions at each timepoint generates a timeseries of betas is for each predictor, indicating when and how the predictor explained variance across the trial. This makes a lot of sense and is widely used in neuroscience data analysis. In extending this approach to incorporate variables that change within trial, the authors have used the same method of fitting separate regression models at each timepoint, to obtain a timeseries of betas for each predictor. It is less clear that this approach makes sense for variables that change within trial. This is because the resulting betas only capture how variation in the predictor across trials at a given timepoint explains variance in the signal, but does not capture effects of variation in the predictor across timepoints within trials. This partitioning of variance in the predictor into a between-trial component whose effect on the signal is modelled, and a within-trial component whose effect on the signal is not, is artificial in many experiment designs, and may yield hard to interpret results.
Consider e.g. the experimental condition considered in Figure 3, taken from Machen et al. 2025 (doi: 10.1101/2025.03.10.642469) in which mice ran down a linear track to collect rewards. In analysing such data, one might want to know how neural activity covaried with the animal's position, but as this variable changes strongly within trial but will have a similar time-course across trials, the cFLMM analysis approach will not work to quantify these effects. This is because variance attributed to position would not capture how neural activity covaried with changes in the animals position within trial, but rather how neural activity covaried with changes in the animals position from trial-to-trial at a given timepoint, which could occur due to e.g. trial-to-trial differences in latency to start moving or running speed. As such, although significant effects of 'position' might be observed, they would not capture covariation between position and neural activity in a straightforwardly interpretable way.
It is therefore not obvious to me that incorporating variables that change within trial into an analysis framework that runs separate regressions at each timepoint in trial aligned data is likely to be widely useful. If scientific questions require understanding how neural activity covaries as a function of variables that change both within and across trials, an alternative approach would be to run a single regression analysis across all timepoints, and capture the extended temporal responses to discrete behavioural events by using temporal basis functions convolved with the event timeseries. This provides a very flexible framework for capturing covariation of neural activity both with variables that change continuously such as position, and discrete behavioural events such as choices or outcomes, while also handling variable event timing from trial-to-trial.
One way that cFLMM is used in the manuscript is to handle variable timing of trial events in trial aligned data. In the Machen et al. data, the time when the animal reaches the reward varies from trial to trial, and this is represented in the cFLMM analysis by a binary variable which changes value at this timepoint. From the resulting beta coefficient timeseries (Figure 3C) it is not straightforward to understand how neural activity changed as the subject approached and then received the reward. A simpler approach to quantify this, which I think would have yielded more interpretable coefficient timeseries would have been to align activity across trials on when the subject obtained the reward, rather than on the start of the trial, allowing e.g. the effect of reward type to be visualised as a function of time relative to reward delivery, and hence to see the differential effects during approach vs consumption. More broadly, handling variable trial timing in analyses like FLMM which use trial aligned data, can be achieved either by separately aligning the data to different trial events of interest or by time warping the signal to align multiple important timepoints across trials. It is not obvious that using cFLMM with binary indicator variables that indicate when task states changed will yield a clearer picture of neural activity than these methods.
It may be that I am missing some key strengths of cFLMM relative to the other approaches I have outlined, or that there are applications where this approach to implementing within-trial variable changes is a natural formalism. However my impression is that while cFLMM represent a technical advance, it is not clear how widely useful the model formalism will be.