View source: R/realizedMeasures.R
rSVar | R Documentation |
Calculate the realized semivariances, defined in Barndorff-Nielsen et al. (2008).
Function returns two outcomes:
Downside realized semivariance
Upside realized semivariance.
Assume there are N
equispaced returns r_{t,i}
in period t
, i=1, \ldots,N
.
Then, the rSVar
is given by
\mbox{rSVardownside}_{t}= \sum_{i=1}^{N} (r_{t,i})^2 \ \times \ I [ r_{t,i} < 0]
\mbox{rSVarupside}_{t}= \sum_{i=1}^{N} (r_{t,i})^2 \ \times \ I [ r_{t,i} > 0]
rSVar(rData, alignBy = NULL, alignPeriod = NULL, makeReturns = FALSE, ...)
rData |
an |
alignBy |
character, indicating the time scale in which |
alignPeriod |
positive numeric, indicating the number of periods to aggregate over. For example to aggregate.
based on a 5-minute frequency, set |
makeReturns |
boolean, should be |
... |
used internally |
list with two entries, the realized positive and negative semivariances
Giang Nguyen, Jonathan Cornelissen, Kris Boudt, and Emil Sjoerup.
Barndorff-Nielsen, O. E., Kinnebrock, S., and Shephard N. (2010). Measuring downside risk: realised semivariance. In: Volatility and Time Series Econometrics: Essays in Honor of Robert F. Engle, (Edited by Bollerslev, T., Russell, J., and Watson, M.), 117-136. Oxford University Press.
IVar
for a list of implemented estimators of the integrated variance.
sv <- rSVar(sampleTData[, list(DT, PRICE)], alignBy = "minutes",
alignPeriod = 5, makeReturns = TRUE)
sv
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.