unique-comoments: Helper function for comoment matrices

unique-comomentsR Documentation

Helper function for comoment matrices

Description

transforms vector with unique coskewness or cokurtosis elements to the full coskewness and cokurtosis matrix. Also works in the reverse direction by extracting the unique coskewness and cokurtosis elements from full the coskewness or cokurtosis matrices.

Usage

M3.vec2mat(M3, p)

M3.mat2vec(M3)

M4.vec2mat(M4, p)

M4.mat2vec(M4)

Arguments

M3

matrix of dimension p x p^2, or a vector with (p * (p + 1) * (p + 2) / 6) unique coskewness elements

p

number of variables; the number of instruments for which the coskewness or cokurtosis matrix/vector was computed

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 output of M3.MM and M4.MM, depending on the optional argument as.mat.

Author(s)

Kris Boudt, Peter Carl, Dries Cornilly, Brian Peterson

See Also

CoMoments
ShrinkageMoments
EWMAMoments
StructuredMoments
MCA
NCE

Examples


data(managers)
p <- ncol(edhec)

# transform coskewness between matrix and vector format
m3 <- M3.MM(edhec, as.mat=TRUE)
m3bis <- M3.vec2mat(M3.MM(edhec, as.mat=FALSE), p)
sum((m3 - m3bis)^2)

# transform cokurtosis between matrix and vector format
m4 <- M4.MM(edhec, as.mat=FALSE)
m4bis <- M4.mat2vec(M4.MM(edhec, as.mat=TRUE))
sum((m4 - m4bis)^2)


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