calculates exponentially weighted moving average covariance, coskewness and cokurtosis matrices

M2.ewma(R, lambda = 0.97, last.M2 = NULL, ...)

M3.ewma(R, lambda = 0.97, last.M3 = NULL, as.mat = TRUE, ...)

M4.ewma(R, lambda = 0.97, last.M4 = NULL, as.mat = TRUE, ...)

Arguments

R

an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns (with mean zero)

lambda

decay coefficient

last.M2

last estimated covariance matrix before the observed returns R

any other passthru parameters

last.M3

last estimated coskewness matrix before the observed returns R

as.mat

TRUE/FALSE whether to return the full moment matrix or only the vector with the unique elements (the latter is advised for speed), default TRUE

last.M4

last estimated cokurtosis matrix before the observed returns R

Details

The coskewness and cokurtosis matrices are defined as the matrices of dimension p x p^2 and p x p^3 containing the third and fourth order central moments. They are useful for measuring nonlinear dependence between different assets of the portfolio and computing modified VaR and modified ES of a portfolio.

EWMA estimation of the covariance matrix was popularized by the RiskMetrics report in 1996. The M3.ewma and M4.ewma are straightforward extensions to the setting of third and fourth order central moments

References

JP Morgan. Riskmetrics technical document. 1996.

See also

CoMoments ShrinkageMoments StructuredMoments MCA

Examples

data(edhec) # EWMA estimation # 'as.mat = F' would speed up calculations in higher dimensions sigma <- M2.ewma(edhec, 0.94) m3 <- M3.ewma(edhec, 0.94) m4 <- M4.ewma(edhec, 0.94) # compute equal-weighted portfolio modified ES mu <- colMeans(edhec) p <- length(mu) ES(p = 0.95, portfolio_method = "component", weights = rep(1 / p, p), mu = mu, sigma = sigma, m3 = m3, m4 = m4)
#> $MES #> [1] 0.03593744 #> #> $contribution #> [1] 0.0079979527 -0.0023398485 0.0040806253 0.0079165121 0.0007909966 #> [6] 0.0039465684 0.0048861335 0.0008662255 0.0041314124 0.0012537442 #> [11] 0.0039907892 -0.0058159612 0.0042322857 #> #> $pct_contrib_MES #> [1] 0.22255212 -0.06510894 0.11354804 0.22028595 0.02201038 0.10981775 #> [7] 0.13596222 0.02410371 0.11496124 0.03488686 0.11104825 -0.16183573 #> [13] 0.11776816 #>
# compare to sample method sigma <- cov(edhec) m3 <- M3.MM(edhec) m4 <- M4.MM(edhec) ES(p = 0.95, portfolio_method = "component", weights = rep(1 / p, p), mu = mu, sigma = sigma, m3 = m3, m4 = m4)
#> $MES #> [1] 0.03241585 #> #> $contribution #> [1] 0.0074750513 -0.0028125166 0.0039422674 0.0069376579 0.0008077760 #> [6] 0.0037114666 0.0043125937 0.0007173036 0.0036152960 0.0013693293 #> [11] 0.0037650911 -0.0048178690 0.0033924063 #> #> $pct_contrib_MES #> [1] 0.23059863 -0.08676361 0.12161541 0.21402052 0.02491917 0.11449542 #> [7] 0.13303965 0.02212817 0.11152864 0.04224258 0.11614968 -0.14862694 #> [13] 0.10465269 #>