Learn R Programming

highfrequency (version 0.6.5)

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, align.by = NULL, align.period = NULL, makeReturns = FALSE)

Arguments

rdata

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

align.by

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

align.period

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(sample_tdata)
rSV(sample_tdata$PRICE, align.by = "minutes", align.period = 5, makeReturns = TRUE)
# }

Run the code above in your browser using DataLab