I want to estimate the covariance matrix using high-frequency data in Julia. I wish to start with using the realized covariance estimator. Thus, is there any available Julia code to estimate using rcov?
I don't think you need a package for this. Realized covariance is a very simple estimator. Let pmat denote a matrix of high-frequency prices, where columns correspond to assets, and rows correspond to the time-index. The high frequency returns can be obtained via:
rmat = log.(pmat[2:end,:] ./ pmat[1:end-1,:])
Note, you could speed up this computation by using a loop instead to avoid temporary allocations. Or as Oscar points out in the comments:
I don't think you need a package for this. Realized covariance is a very simple estimator. Let
pmat
denote a matrix of high-frequency prices, where columns correspond to assets, and rows correspond to the time-index. The high frequency returns can be obtained via:Note, you could speed up this computation by using a loop instead to avoid temporary allocations. Or as Oscar points out in the comments:
will also reduce temporaries while preserving the neat one-liner.
Given
rmat
, the realized covariance estimator spanning the first to last time index is just: