portfolio-moments | R Documentation |
computes the portfolio second, third and fourth central moments given the multivariate comoments and the portfolio weights. The gradient functions compute the gradient of the portfolio central moment with respect to the portfolio weights, evaluated in the portfolio weights.
portm2(w, sigma)
derportm2(w, sigma)
portm3(w, M3)
derportm3(w, M3)
portm4(w, M4)
derportm4(w, M4)
w |
vector of length p with portfolio weights |
sigma |
portfolio covariance matrix of dimension p x p |
M3 |
matrix of dimension p x p^2, or a vector with (p * (p + 1) * (p + 2) / 6) unique coskewness elements |
M4 |
matrix of dimension p x p^3, or a vector with (p * (p + 1) * (p + 2) * (p + 3) / 12) unique coskewness elements |
For documentation on the coskewness and cokurtosis matrices, we refer to ?CoMoments. Both the full matrices and reduced form can be the used as input for the function related to the portfolio third and fourth central moments.
Kris Boudt, Peter Carl, Dries Cornilly, Brian Peterson
CoMoments
ShrinkageMoments
EWMAMoments
StructuredMoments
MCA
data(managers)
# equal weighted portfolio of managers
p <- ncol(edhec)
w <- rep(1 / p, p)
# portfolio variance and its gradient with respect to the portfolio weights
sigma <- cov(edhec)
pm2 <- portm2(w, sigma)
dpm2 <- derportm2(w, sigma)
# portfolio third central moment and its gradient with respect to the portfolio weights
m3 <- M3.MM(edhec)
pm3 <- portm3(w, m3)
dpm3 <- derportm3(w, m3)
# portfolio fourth central moment and its gradient with respect to the portfolio weights
m4 <- M4.MM(edhec)
pm4 <- portm4(w, m4)
dpm4 <- derportm4(w, m4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.