Description Usage Arguments Note
View source: R/QuantAnalysis.R
Weighted average covariance matrix
1 2 3 4 5 6 7 8 9 | cov_wgt_avg(
ret,
long_win = 252,
med_win = 63,
short_win = 21,
long_wgt = 0.25,
med_wgt = 0.25,
short_wgt = 0.5
)
|
ret |
data.frame containing returns |
long_win |
= long window length |
med_win |
= medium window length |
short_win |
= short window length |
long_wgt |
= weight of long window covariance |
med_wgt |
= weight of medium window covariance |
short_wgt |
= weight of short window covariance |
The short window and weight place a higher emphasis on recent returns, while the longer window and weight place a more neutral weight on recent returns and returns further in the past. This covariance calculation is similar to an exponentially weighted moving average but is less computationally intensive.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.