Learn R Programming

highfrequency (version 0.7.0.1)

rSV: Realized semivariance of highfrequency return series.

Description

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 ] $$

Usage

rSV(rData, alignBy = NULL, alignPeriod = NULL, makeReturns = FALSE)

Arguments

rData

a zoo/xts object containing all returns in period t for one asset.

alignBy

a string, align the tick data to "seconds"|"minutes"|"hours".

alignPeriod

an integer, align the tick data to this many [seconds|minutes|hours].

makeReturns

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

Value

list with to arguments. The realized positive and negative semivariance.

References

Barndorff-Nielsen, O.E., Kinnebrock, S. and Shephard N. (2008). Measuring downside risk - realized semivariance. CREATES research paper. p. 3-5.

Examples

Run this code
# NOT RUN {
data(sampleTData)
rSV(sampleTData$PRICE, alignBy = "minutes", alignPeriod = 5, makeReturns = TRUE)
# }

Run the code above in your browser using DataLab