View source: R/realizedMeasures.R
rMRCov | R Documentation |
Calculate univariate or multivariate pre-averaged estimator, as defined in Hautsch and Podolskij (2013).
rMRCov( pData, pairwise = FALSE, makePsd = FALSE, theta = 0.8, crossAssetNoiseCorrection = FALSE, ... )
pData |
a list. Each list-item contains an |
pairwise |
boolean, should be |
makePsd |
boolean, in case it is |
theta |
a |
crossAssetNoiseCorrection |
a |
... |
used internally, do not change. |
In practice, market microstructure noise leads to a departure from the pure semimartingale model. We consider the process Y in period τ:
\mbox{Y}_{τ} = X_{τ} + ε_{τ},
where the observed d dimensional log-prices are the sum of underlying Brownian semimartingale process X and a noise term ε_{τ}.
ε_{τ} is an i.i.d. process with X.
It is intuitive that under mean zero i.i.d. microstructure noise some form of smoothing of the observed log-price should tend to diminish the impact of the noise. Effectively, we are going to approximate a continuous function by an average of observations of Y in a neighborhood, the noise being averaged away.
Assume there is N equispaced returns in period τ of a list (after refreshing data). Let r_{τ_i} be a return (with i=1, …,N) of an asset in period τ. Assume there is d assets.
In order to define the univariate pre-averaging estimator, we first define the pre-averaged returns as
\bar{r}_{τ_j}^{(k)}= ∑_{h=1}^{k_N-1}g≤ft(\frac{h}{k_N}\right)r_{τ_{j+h}}^{(k)}
where g is a non-zero real-valued function g:[0,1] \rightarrow R given by g(x) = \min(x,1-x). k_N is a sequence of integers satisfying \mbox{k}_{N} = \lfloorθ N^{1/2}\rfloor. We use θ = 0.8 as recommended in Hautsch and Podolskij (2013). The pre-averaged returns are simply a weighted average over the returns in a local window. This averaging diminishes the influence of the noise. The order of the window size k_n is chosen to lead to optimal convergence rates. The pre-averaging estimator is then simply the analogue of the realized variance but based on pre-averaged returns and an additional term to remove bias due to noise
\hat{C}= \frac{N^{-1/2}}{θ ψ_2}∑_{i=0}^{N-k_N+1} (\bar{r}_{τ_i})^2-\frac{ψ_1^{k_N}N^{-1}}{2θ^2ψ_2^{k_N}}∑_{i=0}^{N}r_{τ_i}^2
with
ψ_1^{k_N}= k_N ∑_{j=1}^{k_N}≤ft(g≤ft(\frac{j+1}{k_N}\right)-g≤ft(\frac{j}{k_N}\right)\right)^2,\quad
ψ_2^{k_N}= \frac{1}{k_N}∑_{j=1}^{k_N-1}g^2≤ft(\frac{j}{k_N}\right).
ψ_2= \frac{1}{12}
The multivariate counterpart is very similar. The estimator is called the Modulated Realized Covariance (rMRCov) and is defined as
\mbox{MRC}= \frac{N}{N-k_N+2}\frac{1}{ψ_2k_N}∑_{i=0}^{N-k_N+1}\bar{\boldsymbol{r}}_{τ_i}\cdot \bar{\boldsymbol{r}}'_{τ_i} -\frac{ψ_1^{k_N}}{θ^2ψ_2^{k_N}}\hat{Ψ}
where \hat{Ψ}_N = \frac{1}{2N}∑_{i=1}^N \boldsymbol{r}_{τ_i}(\boldsymbol{r}_{τ_i})'. It is a bias correction to make it consistent. However, due to this correction, the estimator is not ensured PSD. An alternative is to slightly enlarge the bandwidth such that \mbox{k}_{N} = \lfloorθ N^{1/2+δ}\rfloor. δ = 0.1 results in a consistent estimate without the bias correction and a PSD estimate, in which case:
\mbox{MRC}^{δ}= \frac{N}{N-k_N+2}\frac{1}{ψ_2k_N}∑_{i=0}^{N-k_N+1}\bar{\boldsymbol{r}}_i\cdot \bar{\boldsymbol{r}}'_i
A d \times d covariance matrix.
Giang Nguyen, Jonathan Cornelissen, Kris Boudt, and Emil Sjoerup.
Hautsch, N., and Podolskij, M. (2013). Preaveraging-based estimation of quadratic variation in the presence of noise and jumps: theory, implementation, and empirical Evidence. Journal of Business & Economic Statistics, 31, 165-183.
ICov
for a list of implemented estimators of the integrated covariance.
## Not run: library("xts") # Note that this ought to be tick-by-tick data and this example is only to show the usage. a <- list(as.xts(sampleOneMinuteData[as.Date(DT) == "2001-08-04", list(DT, MARKET)]), as.xts(sampleOneMinuteData[as.Date(DT) == "2001-08-04", list(DT, STOCK)])) rMRCov(a, pairwise = TRUE, makePsd = TRUE) # We can also add use data.tables and use a named list to convey asset names a <- list(foo = sampleOneMinuteData[as.Date(DT) == "2001-08-04", list(DT, MARKET)], bar = sampleOneMinuteData[as.Date(DT) == "2001-08-04", list(DT, STOCK)]) rMRCov(a, pairwise = TRUE, makePsd = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.