the best approach is to find cross spectral density of respiration and RR intervals (or interbeat intervals IBI for the PPG). You can interpolate sequence of IBIs in the window and use FFT to find cross spectrum in the range of "breathing frequencies".
I would try it offline on the same data set and compare the results with the classic spectral-based RSA. I like James' suggestion as well, particularly if you want to decrease latency. However, because of the phase shift you might need to create more robust algorithm or expand processing window, but then you can use other methods as well.
James Leigh I guess what you pointed is similar to finding minimum and maximum period of RR interval and take the ln of that difference. https://www.biopac.com/wp-content/uploads/RSA-Results.jpg
well, strictly speaking, you need both magnitude of breathing and change of RR intervals (HRV). If you have ECG only, you might extract breathing period from magnitude of R-peaks, but actual magnitude (lung volume) could not be reliably extracted from ECG.
However, you might be able to use only amplitude (max-min) of RR intervals only, for some applications that will be sufficient.
The other issue: when the breathing becomes very slow (close to 6 breaths/sec -> 10 sec/breath = 0.1 Hz) both peaks of spectrum overlap creating resonant effect that must be considered. Please take a look at:
- E. Vaschillo, B. Vaschillo, P. Lehrer, “Characteristics of Resonance
in Heart Rate Variability Stimulated by Biofeedback,” Appl
Psychophysiol Biofeedback, June 2006, 31(2):129:142.
- E. Jovanov, “Real-time Monitoring of Spontaneous Resonance in Heart Rate Variability,” Proc. of the 30th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Vancouver, Canada, August 20 – 24, 2008, pp. 2789-2792. http://www.ece.uah.edu/~jovanov/papers/C2008_Jovanov_HRV.pdf