rKernelCov {highfrequency} | R Documentation |
Realized kernel estimator
Description
Realized covariance calculation using a kernel estimator.
The different types of kernels available can be found using listAvailableKernels
.
Usage
rKernelCov(
rData,
cor = FALSE,
alignBy = NULL,
alignPeriod = NULL,
makeReturns = FALSE,
kernelType = "rectangular",
kernelParam = 1,
kernelDOFadj = TRUE,
...
)
Arguments
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. |
Details
Let r_{t,i}
be N
returns in period t
, i = 1, \ldots, N
. The returns or prices
do not have to be equidistant. The kernel estimator for H = \code{kernelParam}
is given by
\gamma_0 + 2 \sum_{h = 1}^H k \left(\frac{h-1}{H}\right) \gamma_h,
where k(x)
is the chosen kernel function and
\gamma_h = \sum_{i = h}^N r_{t,i} \times r_{t,i-h}
is the empirical autocovariance function. The multivariate version employs the cross-covariances instead.
Value
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.
Author(s)
Scott Payseur, Onno Kleen, and Emil Sjoerup.
References
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.
See Also
ICov
for a list of implemented estimators of the integrated covariance.
Examples
# Univariate:
rvKernel <- rKernelCov(rData = sampleTData[, list(DT, PRICE)], alignBy = "minutes",
alignPeriod = 5, makeReturns = TRUE)
rvKernel
# Multivariate:
rcKernel <- rKernelCov(rData = sampleOneMinuteData, makeReturns = TRUE)
rcKernel