# Automated Processing of fNIRS Data--A Visual Guide to the Pitfalls and Consequences
## 4 Discussion
### Glm  
The fNIRS community has moved from visually inspecting activation and the statistical evaluation of the averaged rest and task period (\(t\)-test or ANOVA) to the general linear model (GLM). GLM uses the entire time course of fNIRS and its high temporal resolution, which improves statistical power, making GLM the preferred technique [28] in fMRI [72] as well as fNIRS [73]. We chose a commonly used paradigm with repetitive on and off stimuli, which has a high detection power for GLM analysis [74]. However, in our current study, with the usage of standard preprocessing steps such as low-frequency filtering, the GLM has to take into account the facts that (1) hemoglobin time courses are autocorrelated and (2) low-frequency filtering increases this autocorrelation. The result is normally a systematic over-estimation of the error degrees of freedom (lower true number of independent observations) inflating the \(t\)-values and Type I error [57; 75; 76]. A comparison of how pre-whitening and robust regression (as used here) can improve the validity of the statistics is described by [PERSON] et al. [76]. The pre-whitening step is included within the GLM code used here [57]. However, pre-whitening depends highly on the order of how the error term is estimated. Especially since pre-processing steps as low-pass filtering can affect this estimate and therefore the results, it is necessary to continue research on that topic.  
In addition it is not considered to be necessary to remove motion with the GLM used here and it is in general not recommended to apply the pre-filtering step (bandpass filter) as a separate step [57], as done in this study. Instead, it is recommended to only filter within the regression model [76], to avoid inflation. However, we did find better results with motion correction and bandpass filter beforehand (not shown). The discussion on what to include in an automated GLM analysis and how to counteract autocorrelation and inflated statistics will likely continue.  
Consideration of the shape and timing of the hemodynamic response, not only between but also within participants, remains for all fNIRS statistical evaluations. General practice is to use the default settings of statistical tools such as the gamma function [77; 78] in statistical parametric mapping (SPM) or the peak delays of 5 s as hardcoded in the software fOSA [79] for the hemodynamic response function. However, studies have shown that the peak delay and shape may be important variables to study, as they differ between participants, as well as within participants, for each hemoglobin signal, task and brain region [37]. Various papers have modeled the hemodynamic response function, however the importance of the implementation of these models in statistical software packages has only started to be addressed recently (e.g., in the Automatic IDentification of functional Events (AIDE) software using a multitude of shapes and delays [40]). Adding derivatives (temporal and dispersion derivatives), as is standard in fMRI analysis, significantly enhanced detection of activation and increased detection of activation in the ROI channels (Figure 13) and is a step in the right direction.