Removes slow trends from a uniformly sampled series (e.g. an interpolated
RR tachogram) using the smoothness-priors method of Tarvainen et al. (2002).
The trend estimate is \((I + \lambda^2 D_2^\top D_2)^{-1} z\) where
\(D_2\) is the second-order difference operator, and the detrended
(stationary) component is \(z_{stat} = (I - (I + \lambda^2
D_2^\top D_2)^{-1}) z\). Larger lambda lowers the cutoff frequency,
removing more low-frequency content.
Value
The detrended series (numeric vector, near-zero mean), carrying
attributes lambda and cutoff_hz (the approximate half-power
cutoff of the implied high-pass filter).
References
Tarvainen, M.P., Ranta-aho, P.O. & Karjalainen, P.A. (2002). An advanced detrending method with application to HRV analysis. IEEE Transactions on Biomedical Engineering, 49(2), 172-175.