Function returns realized semivariances, defined in Barndorff-Nielsen et al. (2008).
Function returns two outcomes: 1.Downside realized semivariance and 2.Upside realized semivariance.
Assume there is \(N\) equispaced returns in period \(t\). Let \(r_{t,i}\) be a return (with \(i=1, \ldots,N\)) in period \(t\).
Then, the rSV is given by
$$
\mbox{rSVdownside}_{t}= \sum_{i=1}^{N} (r_{t,i})^2 \ \times \ I [ r_{t,i} <0 ]
$$
$$
\mbox{rSVupside}_{t}= \sum_{i=1}^{N} (r_{t,i})^2 \ \times \ I [ r_{t,i} >0 ]
$$