Function that estimates whether one series leads (or lags) another.
Let \(X_{t}\) and \(Y_{t}\) be two observed price over the time interval \([0,1]\).
For every integer \(k \in \cal{Z}\), we form the shifted time series
$$
Y_{\left(k+i\right)/n}, \quad i = 1, 2, \dots
$$
\(H=\left(\underline{H},\overline{H}\right]\) is an interval for \(\vartheta\in\Theta\), define the shift interval \(H_{\vartheta}=H+\vartheta=\left(\underline{H}+\vartheta,\overline{H}+\vartheta\right]\) then let
$$
X\left(H\right)_{t}=\int_{0}^{t}1_{H}\left(s\right)\textrm{d}X_{s}
$$
Which will be abbreviated:
$$
X\left(H\right)=X\left(H\right)_{T+\delta}=\int_{0}^{T+\delta}1_{H}\left(s\right)\textrm{d}X_{s}
$$
Then the shifted HY contrast function is:
$$
\tilde{\vartheta}\rightarrow U^{n}\left(\tilde{\vartheta}\right)= \\
1_{\tilde{\vartheta}\geq0}\sum_{I\in{\cal{I}},J\in{\cal{J}},\overline{I}\leq T}X\left(I\right)Y\left(J\right)1_{\left\{ I\cap J_{-\tilde{\vartheta}}\neq\emptyset\right\}} \\
+1_{\tilde{\vartheta}<0}\sum_{I\in{\cal{I}},J\in{\cal{J}},\overline{J}\leq T}X\left(I\right)Y\left(Y\right)1_{\left\{ J\cap I_{\tilde{\vartheta}}\neq\emptyset\right\} }
$$
This contrast function is then calculated for all the lags passed in the argument lags