# Stochastic Modeling and Optimal Time-Frequency Estimation of Task-Related HRV
## Methods
### Mean Square Error Optimal Time-Frequency Kernel  
The MSE optimal model based TF smoothing kernel can be derived and evaluated once the model parameters of the LSCP are estimated. In the following, \(\mathcal{F}f\) denotes the Fourier transform of the function \(f\).  
The Wigner-Ville spectrum (WVS) of an LSP is defined as  
\[W(t,\omega) =\int_{-\infty}^{\infty}\mathbb{E}\left[X\left(t+\frac{\tau}{2} \right)X^{*}\left(t-\frac{\tau}{2}\right)\right]e^{-i\omega\tau}d\tau\] \[=q(t)\cdot\mathcal{F}r(\omega) \tag{7}\]  
[19; 20], and the corresponding ambiguity spectrum as  
\[A(\theta,\tau) =\int_{-\infty}^{\infty}\mathbb{E}\left[X\left(t+\frac{\tau}{2} \right)X\left(t-\frac{\tau}{2}\right)\right]e^{-i\theta t}dt\] \[=\mathcal{F}q(\theta)\cdot r(\tau). \tag{8}\]  
Figure 3: (**a**) Spectrogram of a respiratory signal; (**b**) Red line is the linear chirp \(mt-md\) fitted to the instantaneous frequency (black dots) estimated from the spectrogram in (**a**).  
Any TF representation member of the [PERSON]'s class can be expressed as  
\[W_{C}(t,\omega)=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}A(\theta,\tau) \Phi(\theta,\tau)e^{-i(\omega\tau-\theta t)}d\tau d\theta, \tag{9}\]  
where \(\Phi\) is an ambiguity kernel [11]. In [20], the MSE optimal kernel for circularly symmetric LSPs with Gaussian marginals has been derived as  
\[\Phi_{0}(\theta,\tau)=\frac{|A(\theta,\tau)|^{2}}{2\pi(|A(\theta,\tau)|^{2}+B( \theta,\tau))}, \tag{10}\]  
with  
\[|A(\theta,\tau)|^{2} =|\mathcal{F}q(\theta)|^{2}|r(\tau)|^{2},\] \[B(\theta,\tau) =(\mathcal{F}|r|^{2}(\theta))(\mathcal{F}^{-1}|\mathcal{F}q|^{2} (\tau)). \tag{11}\]  
The separable functions in Equation (11) are calculated according to the introduced model Equations (4) and (5) as  
\[|r(\tau)|^{2} =e^{-(c/4)\tau^{2}},\] \[\mathcal{F}|r|^{2}(\theta) =\sqrt{\frac{4\pi}{c}}e^{-(\theta^{2}/c)},\] \[\mathcal{F}q(\theta) =\int_{0}^{+\infty}ae^{(-b-i\theta)\tau}d\tau=\frac{a}{b+i\theta},\] \[|\mathcal{F}q(\theta)|^{2} =\left|\frac{a}{b+i\theta}\right|^{2}=\frac{a^{2}}{b^{2}+\theta^{ 2}},\] \[\mathcal{F}^{-1}|\mathcal{F}q|^{2}(\tau) =\mathcal{F}^{-1}\left(\frac{a^{2}}{b^{2}+\theta^{2}}\right)= \frac{a^{2}}{2b}e^{-b|\tau|}.\]  
The modification of the LSP kernel for LSCP is based on the fact that if a signal \(g_{0}(t)\) is multiplied as \(g(t)=g_{0}(t)\cdot e^{i\cdot(\frac{\pi}{b})t^{2}}\) then the WVS is coordinate transformed as \(W(t,\omega)\to W(t,\omega-m\cdot t)\). From [20], we accordingly find the optimal kernel to become  
\[\Phi(\theta,\tau)=\Phi_{0}(\theta-m\cdot\tau,\tau). \tag{12}\]  
The multitaper approach allows efficient estimation as a weighted sum of windowed spectrograms  
\[W_{C}(t,\omega)=\mathbb{E}\left[\sum_{k=1}^{K}w_{k}\left|\int_{-\infty}^{ \infty}X(s)h_{k}^{*}(t-s)e^{-i\omega s}ds\right|^{2}\right], \tag{13}\]  
with weights \(w_{k}\), and windows \(h_{k}(t)\), \(k=1\ldots K\), given by the eigenvalues \(\alpha\) and eigenvectors \(q\) respectively solution to  
\[\int_{-\infty}^{\infty}\Psi^{rot}(s,t)q(s)ds=\alpha q(t), \tag{14}\]  
where the Hermitian rotated time-lag kernel is defined as  
\[\Psi^{rot}(s,t)=\Psi\left(\frac{s+t}{2},s-t\right), \tag{15}\]  
with  
\[\Psi(t,\tau)=\int_{-\infty}^{\infty}\Phi(\theta,\tau)e^{it\theta}d\theta \tag{16}\]  
as in [20; 21].