portfolio-moments: Portfolio moments

portfolio-momentsR Documentation

Portfolio moments

Description

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.

Usage

portm2(w, sigma)

derportm2(w, sigma)

portm3(w, M3)

derportm3(w, M3)

portm4(w, M4)

derportm4(w, M4)

Arguments

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

Details

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.

Author(s)

Kris Boudt, Peter Carl, Dries Cornilly, Brian Peterson

See Also

CoMoments
ShrinkageMoments
EWMAMoments
StructuredMoments
MCA

Examples


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)


braverock/PerformanceAnalytics documentation built on Feb. 16, 2024, 5:37 a.m.