ReMeDI {highfrequency} | R Documentation |
ReMeDI
Description
This function estimates the auto-covariance of market-microstructure noise
Let the observed price Y_{t}
be given as Y_{t} = X_{t} + \varepsilon_{t}
, where X_{t}
is the efficient price and \varepsilon_t
is the market microstructure noise
The estimator of the l
'th lag of the market microstructure is defined as:
\hat{R}^{n}_{t,l} = \frac{1}{n_{t}} \sum_{i=2k_{n}}^{n_{t}-k_{n}-l} \left(Y_{i+l}^n - Y_{i+l+k_{n}}^{n} \right) \left(Y_{i}^n - Y_{i- 2k_{n}}^{n} \right),
where k_{n}
is a tuning parameter. In the function knChooseReMeDI
, we provide a function to estimate the optimal k_{n}
parameter.
Usage
ReMeDI(pData, kn = 1, lags = 1, makeCorrelation = FALSE)
Arguments
pData |
|
kn |
numeric of length 1 determining the tuning parameter kn this controls the lengths of the non-overlapping interval in the ReMeDI estimation |
lags |
numeric containing integer values indicating the lags for which to estimate the (co)variance |
makeCorrelation |
logical indicating whether to transform the autocovariances into autocorrelations.
The estimate of variance is imprecise and thus, constructing the correlation like this may show correlations that fall outside |
Note
We Thank Merrick Li for contributing his Matlab code for this estimator.
Author(s)
Emil Sjoerup.
References
Li, M. and Linton, O. (2021). A ReMeDI for microstructure noise. Econometrica, forthcoming
Examples
remed <- ReMeDI(sampleTData[as.Date(DT) == "2018-01-02", ], kn = 2, lags = 1:8)
# We can also use the algorithm for choosing the kn tuning parameter
optimalKn <- knChooseReMeDI(sampleTData[as.Date(DT) == "2018-01-02",],
knMax = 10, tol = 0.05, size = 3,
lower = 2, upper = 5, plot = TRUE)
optimalKn
remed <- ReMeDI(sampleTData[as.Date(DT) == "2018-01-02", ], kn = optimalKn, lags = 1:8)