View source: R/realizedMeasures.R
rKernelCov | R Documentation |
Realized covariance calculation using a kernel estimator.
The different types of kernels available can be found using listAvailableKernels
.
rKernelCov( rData, cor = FALSE, alignBy = NULL, alignPeriod = NULL, makeReturns = FALSE, kernelType = "rectangular", kernelParam = 1, kernelDOFadj = TRUE, ... )
rData |
an |
cor |
boolean, in case it is |
alignBy |
character, indicating the time scale in which |
alignPeriod |
positive numeric, indicating the number of periods to aggregate over.
For example, to aggregate based on a 5-minute frequency, set |
makeReturns |
boolean, should be |
kernelType |
Kernel name. |
kernelParam |
Kernel parameter. |
kernelDOFadj |
Kernel degree of freedom adjustment. |
... |
used internally, do not change. |
Let r_{t,i} be N returns in period t, i = 1, …, N. The returns or prices do not have to be equidistant. The kernel estimator for H = \code{kernelParam} is given by
γ_0 + 2 ∑_{h = 1}^H k ≤ft(\frac{h-1}{H}\right) γ_h,
where k(x) is the chosen kernel function and
γ_h = ∑_{i = h}^N r_{t,i} \times r_{t,i-h}
is the empirical autocovariance function. The multivariate version employs the cross-covariances instead.
in case the input is and contains data from one day, an N by N matrix is returned.
If the data is a univariate xts
object with multiple days, an xts
is returned.
If the data is multivariate and contains multiple days (xts
or data.table
), the function returns a list containing N by N matrices.
Each item in the list has a name which corresponds to the date for the matrix.
Scott Payseur, Onno Kleen, and Emil Sjoerup.
Barndorff-Nielsen, O. E., Hansen, P. R., Lunde, A., and Shephard, N. (2008). Designing realized kernels to measure the ex post variation of equity prices in the presence of noise. Econometrica, 76, 1481-1536.
Hansen, P. and Lunde, A. (2006). Realized variance and market microstructure noise. Journal of Business and Economic Statistics, 24, 127-218.
Zhou., B. (1996). High-frequency data and volatility in foreign-exchange rates. Journal of Business & Economic Statistics, 14, 45-52.
ICov
for a list of implemented estimators of the integrated covariance.
# Univariate: rvKernel <- rKernelCov(rData = sampleTData[, list(DT, PRICE)], alignBy = "minutes", alignPeriod = 5, makeReturns = TRUE) rvKernel # Multivariate: rcKernel <- rKernelCov(rData = sampleOneMinuteData, makeReturns = TRUE) rcKernel
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.