I am interested in tracking lost degrees of freedom in XCP-D, like how afni_proc.py already does. Based on Reynolds et al. (preprint) and Caballero-Gaudes & Reynolds (2017), I know that each frequency that is removed by the filter also removes two degrees of freedom. I assumed that that was because filtering is typically applied with a forwards-backwards filter (e.g., scipy.signal.filtfilt), but I could be wrong. If that is the case, then does the effect of the filter on degrees of freedom change with the filter order?
It is not related to the order of the IIR filter (forward-backward filter implemented in scipy.signal.filtfilt). afni_proc.py considers two degrees of freedom because it implements both sine and cosine regressor for each frequency to be removed (at the FFT resolution). @rickr can confirm the implementation.
@CesarCaballeroGaudes is right of course. Note that the sine/cosine regressor method should be identical to that of using a straight FFT (subject to computational truncation differences). Applying direct FFT to data and other regressors before later regression (of more interest) should be the same, but makes it more work to track DoF.