rSVar: Realized semivariance of highfrequency return series

View source: R/realizedMeasures.R

rSVarR Documentation

Realized semivariance of highfrequency return series

Description

Calculate the realized semivariances, defined in Barndorff-Nielsen et al. (2008).

Function returns two outcomes:

  1. Downside realized semivariance

  2. Upside realized semivariance.

Assume there are N equispaced returns r_{t,i} in period t, i=1, …,N.

Then, the rSVar is given by

\mbox{rSVardownside}_{t}= ∑_{i=1}^{N} (r_{t,i})^2 \ \times \ I [ r_{t,i} < 0]

\mbox{rSVarupside}_{t}= ∑_{i=1}^{N} (r_{t,i})^2 \ \times \ I [ r_{t,i} > 0]

Usage

rSVar(rData, alignBy = NULL, alignPeriod = NULL, makeReturns = FALSE, ...)

Arguments

rData

an xts or data.table object containing returns or prices, possibly for multiple assets over multiple days.

alignBy

character, indicating the time scale in which alignPeriod is expressed. Possible values are: "ticks", "secs", "seconds", "mins", "minutes", "hours"

alignPeriod

positive numeric, indicating the number of periods to aggregate over. For example to aggregate. based on a 5-minute frequency, set alignPeriod = 5 and alignBy = "minutes".

makeReturns

boolean, should be TRUE when rData contains prices instead of returns. FALSE by default.

...

used internally

Value

list with two entries, the realized positive and negative semivariances

Author(s)

Giang Nguyen, Jonathan Cornelissen, Kris Boudt, and Emil Sjoerup.

References

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.

See Also

IVar for a list of implemented estimators of the integrated variance.

Examples

sv <- rSVar(sampleTData[, list(DT, PRICE)], alignBy = "minutes",
          alignPeriod = 5, makeReturns = TRUE)
sv

jonathancornelissen/highfrequency documentation built on Jan. 10, 2023, 7:29 p.m.