Learn R Programming

highfrequency (version 1.0.1)

rMPVar: Realized multipower variation

Description

Calculate the Realized Multipower Variation rMPVar, defined in Andersen et al. (2012).

Assume there are \(N\) equispaced returns \(r_{t,i}\) in period \(t\), \(i=1, \ldots,N\). Then, the rMPVar is given by $$ \mbox{rMPVar}_{N}(m,p)= d_{m,p} \frac{N^{p/2}}{N-m+1} \sum_{i=1}^{N-m+1}|r_{t,i}|^{p/m} \ldots |r_{t,i+m-1}|^{p/m} $$

in which

\(d_{m,p} = \mu_{p/m}^{-m}\):

\(m\): the window size of return blocks;

\(p\): the power of the variation;

and \(m\) > \(p/2\).

Usage

rMPVar(
  rData,
  m = 2,
  p = 2,
  alignBy = NULL,
  alignPeriod = NULL,
  makeReturns = FALSE,
  ...
)

Value

numeric

Arguments

rData

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

m

the window size of return blocks. 2 by default.

p

the power of the variation. 2 by default.

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, do not change.

Author

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

References

Andersen, T. G., Dobrev, D., and Schaumburg, E. (2012). Jump-robust volatility estimation using nearest neighbor truncation. Journal of Econometrics, 169, 75-93.

See Also

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

Examples

Run this code
mpv <- rMPVar(sampleTData[, list(DT, PRICE)], m = 2, p = 3, alignBy = "minutes",
            alignPeriod = 5, makeReturns = TRUE)
mpv

Run the code above in your browser using DataLab