MultiStatM: overview

library(MultiStatM)

Background

The package MultiStatM provides general formulae for set partitions, multivariate moments and cumulants, vector Hermite polynomials. It provides theoretical formulae for some important symmetric and asymmetric multivariate distributions and well as estimation functions for multivariate moments and cumulants and connected measures of multivariate skewness and kurtosis.

The formulae implemented in the package can be found in the book “Multivariate Statistical Methods - Going Beyond the Linear”, Springer 2021 by Gy.Terdik and are fully general. For example, in the conversion formulae from multivariate moment to multivariate cumulants, given any list of (numerical) multivariate moments up to order k, the conversion formula provides all multivariate cumulants up to order k; this differs to a large degree from the formulae provided in the package kStatistics (Di Nardo and Guarino, 2022) which calculates one by one (individually) the cumulants of order r which are the entries of our cumulant vectors.

The packages MaxSkew and MultiSkew (Franceschini and Loperfido (2017a,b)) for detecting, measuring and removing multivariate skewness, computes the third multivariate cumulant of either the raw, centered or standardized data; s the main measures of multivariate skewness, together with their bootstrap distributions and provides orthogonal data projections with maximal skewness.

The package matrixcalc (Novomestky (2021)) provides the Commutation matrix, Elimination matrix, Duplication matrix for Cartesian tensor products of two vectors, which are particular cases of those provided in the package MultiStatM.

The package sn ( Azzalini (2022)) discusses for the skew-normal and the skew-t distributions, statistical methods are provided for data fitting and model diagnostics, in the univariate and the multivariate case. Random numbers generator for multivariate skew distributions are provided. In the package MultiStatM complete formulae for theoretical multivariate moments and cumulants of any order are implemented.

The package moments (Komsta and Novomestky (2022)) deals with functions to calculate moments, cumulants, Pearson’s kurtosis, Geary’s kurtosis and skewness; tests related to them from univariate data.

A careful study of the cumulants is a necessary and typical part of nonlinear statistics. Such a study of cumulants for multivariate distributions is made complicated by the index notations. One solution to this problem is the usage of tensor analysis. In this package (and the connected book) we offer an alternate method, which we believe is simpler to follow. The higher-order cumulants with the same degree for a multivariate vector can be collected together and kept as a vector. To be able to do so, we introduce a particular differential operator on a multivariate function, called the T -derivative, and use it to obtain cumulants and provide results which are somewhat analogous to well-known results in the univariate case.

More specifically, with the symbol denoting the Cartesian tensor product, consider the operator Dλ, which we refer to as the T -derivative; see Jammalamadaka et al. (2006) for details. For any function ϕ(λ), the~T -derivative is defined as ϕ is k-times differentiable, with~its k-th T -derivative Dλkϕ(λ) = Dλ(Dλk − 1ϕ(λ)).

In the following we demonstrate the use of this technique through the characterization of several multivariate distributions via their cumulants and by extending the discussion to statistical inference for multivariate skewness and kurtosis.

We note that Kollo (2006) provides formulae for cumulants in terms of matrices; however, retaining a matrix structure for all higher-order cumulants leads to high-dimensional matrices with special symmetric structures which are quite hard to follow notionally and computationally. McCullagh (2018) provides quite an elegant approach using tensor methods; however, tensor methods are not very well known and computationally not so simple.

The method discussed here is based on relatively simple calculus. Although the tensor product of Euclidean vectors is not commutative, it has the advantage of permutation equivalence and allows one to obtain general results for cumulants and moments of any order, as it will be demonstrated in this paper, where general formulae, suitable for algorithmic implementation through a computer software, will be provided.

Methods based on a matrix approach do not provide this type of result; see also (Ould-Baba (2015), which goes as far as the sixth-order moment matrices, whereas there is no such limitation in our derivations and our results. For further discussion, one can see also Kolda (2009) and Qi (2006).

In MultiStatM 2.0.0 many functions of the previous version 1.2.1 have been renamed or grouped for better clarity and joining similar functions producing, for example the same output for univariate or multivariate cases

The table below provides a complete plan of transition from MultiStatM 1.2.1 to MultiStatM 2.0.0. Functions of version 1.2.1 which are within the same rowhave been grouped into a single function. For example the functions conv_Cum2Mom and conv_Cum2MomMulti which provided cumulants to moments conversion respectively in the univariate and multivariate cases have been joined in the function Cum2Mom which has now an option Type=c("Univariate","Multivariate").

MultiStatM 1.2.1

conv_Cum2Mom conv_Cum2MomMulti

MultiStatM 2.0.0

Cum2Mom, Type=Univariate/Multivariate

Family

Moments and cumulants

conv_Mom2Cum conv_Mom2CumMulti Mom2Cum, Type=Univariate/Multivariate Moments and cumulants
conv_Stand_Multi MVStandardize
distr_CFUSN_MomCum_Th MomCumCFUSN Moments and cumulants
distr_SkewNorm_MomCum_Th MomCumSkewNorm Moments and cumulants
distr_Uni_MomCum_Th MomCumUniS Moments and cumulants
distr_ZabsM_MomCum_Th distr_Zabs_MomCum_Th MomCumZabs, Type=Univariate/Multivariate Moments and cumulants
distr_SkewNorm_EVSK_Th EVSKSkewNorm Moments and cumulants
distr_Uni_EVSK_Th distr_UniAbs_EVSK_Th EVSKUniS Type=Standard/Modulus Moments and cumulants
distr_CFUSN_Rand rCFUSN, Random Generation
distr_CFUSSD_Rand rCFUSSD Random Generation
distr_SkewNorm_Rand rSkewNorm Random Generation
distr_Uni_Rand rUniS Random Generation
Esti_Kurt_Mardia Esti_Kurt_MRSz Esti_Kurt_Total SampleKurt Type=Mardia/MRSz/Total Estimation
Esti_Skew_Mardia Esti_Skew_MRSz SampleSkew Type=Mardia/MRSz Estimation
Esti_Kurt_Variance_Th VarianceKurt Estimation
Esti_Skew_Variance_Th VarianceSkew Estimation
Esti_EVSK SampleEVSK Estimation
Esti_Hermite_Poly_HN_M SampleHermiteN | Estimation |
Esti_Gram_Charlier SampleGC Estimation
Esti_MMom_MCum SampleMomCum Estimation
Esti_Variance_Skew_Kurt SampleVarianceSkewKurt
Hermite_Coeff Hermite_CoeffMulti HermiteCoeff Type=Univariate/Multivariate Hermite Polynomials
Hermite_Poly_HN Hermite_Poly_HN_Multi HermiteN Type=Univariate/Multivariate Hermite Polynomials
Hermite_Poly_NH_Inv Hermite_Poly_NH_Multi_In HermiteN2X Type=Univariate/Multivariate Hermite Polynomials
Hermite_Nth Eliminated: use HermiteN
Hermite_N_Cov_X1_X2 HermiteCov12 Hermite Polynomials
indx_Commutator_Kmn indx_Commutator_Kperm indx_Commutator_Mixing indx_Commutator_Moment CommutatorIndx Type=Kmn/Kperm/Mixing/Moment Commutators
indx_Elimination EliminIndx Commutators
indx_Qplication QplicIndx Commutators
indx_Symmetry SymIndx Commutators
indx_UnivMomCum UnivMomCum Commutators
matr_Commutator_Kmn matr_Commutator_Kperm matr_Commutator_Mixing matr_Commutator_Moment CommutatorMatr Type=Kmn/Kperm/Mixing/Moment Commutators
matr_Elimination EliminMatr Commutators
matr_Qplication QplicMatr Commutators
matr_Symmetry SymMatr Commutators
Partition_2Perm Partition_Diagrams Partition_Indecomposable Partition_Pairs Partitions Type=2Perm/Diagram/Indecomp Partitions
Permutation_Inverse PermutationInv Partitions
Partition_Type_All PartitionTypeAll Partitions

Set Partitions

MultiStatM provides several functions dealing with set partitions. Such functions provide some basic tools used to build the multivariate formulae for moments and cumulants in the following sections.

Generally a set of N elements can be split into a set of disjoint subsets, i.e. it can be partitioned. The set of N elements will correspond to set 1 : N = {1, 2, …, N}. If ${\cal{K}} = \{b_1, b_2, \dots , b_r \}$ where each bj ⊂ 1 : N, then ${\cal{K}}$ is a partition provided bj = 1 : N, each bj is non-empty and bj ∩ bi = ∅ (the empty set) is disjoint whenever j ≠ i. The subsets bj, j = 1, 2, …, r are called the blocks of $\cal{K}$. We will call r (the number of the blocks in partition $\cal{K}$), the size of $\cal{K}$, and denote it by $|{\cal{K}}| = r$, and a partition with size r will be denoted by ${\cal{K}}_{\{r\}}$. Let us denote the set of all partitions of the numbers 1 : N by ${\cal{P}}_N$.

Consider next a partition 𝒦{r} = {b1, b2, …, br} ∈ 𝒫N, with size r. Denote the cardinality kj of a block in the partition 𝒦{r}, i.e. kj = |bj|. The type of a partition 𝒦{r} is l = [l1, …, lN], if 𝒦{r} contains exactly lj blocks with cardinality j. The type l is with length N always. A partition with size r and type l will be denoted by 𝒦{r|l}. It is clear that lj ≥ 0, and jjlj = N, and jlj = r. Naturally, some lj’s are zero. A block constitutes a row vector of entries 0’s and 1’s with length N. The places of 1’s correspond to the elements of the block. A partition matrix collects the rows of its blocks, it is an r × N matrix with column-sums 1.

The basic function is PartitionTypeAll which provides complete information on the partition of a set of N elements, namely:

  • S_N_r: a vector with the number of partitions of size r=1, r=2, etc. (Stirling numbers of the second kind); S_N_r[r] denotes the number of partition matrices of size r.

  • Part.class: the list of all possible partitions given as partition matrices. This list is enumerated according to S_N_r[r], r = 1, 2, …N, such that the partition matrices with size R are listed from r < R[r] + 1 up to r ≤ R[r]. The order of the partition matrices within a fixed size is called canonical.

  • S_r_j: a list of vectors of number of partitions with given types grouped by partitions of size r=1, r=2, etc.; an entry is the number of partitions with that type.

  • eL_r: a list of partition types with respect to partitions of size r=1, r=2, etc. ; since a partition type is a row vector with length N this list includes matrices of types (row vectors), the number of rows are the length of vectors of S_r_j of a given size r.

Example 1. Consider the case where N=4 and run the following

PTA<-PartitionTypeAll(4)

S_N_r provides the number of partitions with r=1 to r=4 blocks:

PTA$S_N_r
#> [1] 1 7 6 1

All the partition matrices are listed in Part.class, for example the first partition matrix of size 2 among 7 is

PTA$Part.class[[2]]
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    1    1    0
#> [2,]    0    0    0    1

The second partition matrix of size 3 is

PTA$Part.class[[10]] 
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    0    1    0
#> [2,]    0    1    0    0
#> [3,]    0    0    0    1

etc.. If one interested in the number of partitions with different types for r=2 then consider the list S_r_j, i.e.

PTA$S_r_j[[2]] 
#> [1] 4 3

That is, for partitions with r=2 blocks, there are 2 possible types with 4 and 3 partitions each. These types will show up in the list eL_r:

PTA$eL_r
#> [[1]]
#> [1] 0 0 0 1
#> 
#> [[2]]
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    0    1    0
#> [2,]    0    2    0    0
#> 
#> [[3]]
#> [1] 2 1 0 0
#> 
#> [[4]]
#> [1] 4 0 0 0

From the results above we see that there are: 1 partition of 1 block ( r=1); 7 partitions of two blocks (r=2); 6 partitions of 3 blocks and 1 partition of 4 blocks. From PTA$eL_r}[[2]] we see that there are two types of partition with r=2: the first is of type [1, 0, 1, 0] = (l1 = 1, l2 = 0, l3 = 1, l4 = 0) with 4 partitions and the second is of type [0, 2, 0, 0] = (l1 = 0, l2 = 2, l3 = 0, l4 = 0) with 3 partitions.

Another general function in this class is Partitions which has a Type argument in order to specify the type of partition to compute: 2Perm which provides the permutation of N elements according to a partition matrix L; Diagram which provides the list of partition matrices indecomposable with respect to L, representing diagrams without loops; Indecomp, which provides the list of all indecomposable partitions with respect to a partition matrix L; Pairs, which provides the list of partitions dividing into pairs the set of N elements.

Commutators, symmetrizer and selection matrices

The CommutatorMatr function produces commutators and selection matrices. The use of matrices allows represent as linear combinations problems of permutation and powers of T-products. On the other side, the size of these matrix can quickly become quite important. To deal with this issues and option for sparse matrices is always provided; also a corresponding CommutatorIndx function is provided; these function provide selection vectors which give equivalent results and the corresponding functions in the group Matr.

Kmn produces a commutation matrix, with usual notation Km ⋅ n, of dimension mn × mn such that, given a matrix A m × n, Km ⋅ nvec A = vec A (see @terdik2021multivariate, p.8) while Kperm produce any permutation of Kronecker products of vectors of any length.

Example 2. For the product of vectors a1 ⊗ a2 ⊗ a3 of dimensions d1 to d3 respectively. CommutatorMatr(Type="Kperm",c(3,1,2),c(d1,d2,d3)) produces a3 ⊗ a1 ⊗ a2.

a1<-c(1,2)
a2<-c(2,3,4)
a3<-c(1,3)
p1<-a1%x%a2%x%a3
c(CommutatorMatr(Type="Kperm",c(3,1,2),c(2,3,2))%*%p1) 
#>  [1]  2  3  4  4  6  8  6  9 12 12 18 24
a3%x%a1%x%a2 
#>  [1]  2  3  4  4  6  8  6  9 12 12 18 24

The same result can be obtained by using CommutatorIndx

p1[CommutatorIndx(Type="Kperm",c(3,1,2),c(2,3,2))]
#>  [1]  2  3  4  4  6  8  6  9 12 12 18 24

The CommutatorMatr with Type="Mixing" is exploited for deriving the covariance matrix of Hermite polynomials; see Terdik (2021, 4.6).

The Elimination and Qplication matrices- related functions respectively eliminate and restore duplicated or q-plicated elements in powers of T-products.

a<-c(1,2)
a3<-a%x%a%x%a
a3
#> [1] 1 2 2 4 2 4 4 8
c(EliminMatr(2,3)%*%a3)
#> [1] 1 2 4 8
c(QplicMatr(2,3)%*%EliminMatr(2,3)%*%a3)
#> [1] 1 2 2 4 2 4 4 8

Closely connected to the above matrices are the functions UnivMomCum and EliminIndx. The former provides a vector of indexes to select univariate moments or cumulants of the single elements of a d-vector X from available vector of T-moments and T-cumulants. The latter eliminates the duplicated/q-plicated elements in a T-vector of multivariate moments and cumulants. The function EliminIndx produces the same results as EliminMatr and it is less demanding in terms of memory. The use of EliminMatr can be preferable is one wishes to deal with linear combination of matrices. See examples 4 and 6 below for the use of UnivMomCum and EliminIndx.

The symmetrizer matrix, a dn × dn matrix for the symmetrization of a T-product of n vectors with the same dimension d which overcomes the difficulties arising from the non commutative property of the Kronecker product, and simplifies considerably the computation formulae for multivariate polynomials and their derivatives (see Holmquist (1996) for details). The symmetrizer for a T-product of q vectors of dimension d is defined as $$ \mathbf{S}_{d \mathbf{1}q}=\frac{1}{q} \sum_{p \in \cal{P}_q} \mathbf{K}_p $$ where $\cal{P}_q$ is the set of all permutations of the numbers 1 : q and Kp is the commutator matrix of for the permutation $p \in \cal{P}_q$, (i.e. the CommutatorMatrKperm with Type="Kperm"of the package). Note that, by definition, computing the symmetrizer requires q! operations; in the package, the computational complexity is overcome by exploiting the Chacon and Duong (2015) efficient recursive algorithms for functionals based on higher order derivatives.

Multivariate T-Hermite Polynomials

Consider a Gaussian vector X of dimension d with E X and Σ = Cov (X) = E XX and define the generator function $$\begin{split} \Psi(\mathbf{X}; \mathbf{a})&=\exp \left(\mathbf{a}'\mathbf{X} - \frac{1}{2} \mathbf{a}' \mathbf{\Sigma} \mathbf{a}\right) \\ &=\exp \left(\mathbf{a}'\mathbf{X} - \frac{1}{2} \boldsymbol{\kappa}_2^{\otimes\prime} \mathbf{a}^{\otimes 2} \right) \\ \end{split} $$ where a is a d-vector of constants and κ2 = vec Σ. The vector Hermite polynomials is defined via the T-derivative of the generator function, viz. Hn(X) = DanΨ(X; a)|a = 0 For example one has H1(X) = X,  H2(X) = X⊗2 − κ2 Note that the multivariate T-Hermite polynomial Hn(X) is a vector of dimension dn which contains the n-th order polynomials of the vector Xn. For example the entries of H2(X) are the second order Hermite polynomials H2(Xi, Xj), i, j = 1, 2, …d; for d = 2 H2(X) = ((X12 − σ11), (X1X2 − σ12), (X2X1 − σ21), (X22 − σ22)). Note that Hn(X) is n-symmetric, i.e. H2(X) = Sd1nH2(X) where Sd1n is the symmetrizer defined in […]. From this one can get useful recursion formulae Hn(X) = Sd1n(Hn − 1(X) ⊗ X − (n − 1)Hn − 2(X) ⊗ κ2).

For further details, consult Terdik (2021, 4.5).

The definition of the d-variate Hermite polynomial requires the covariance matrix Σ of the vector X. The HermiteN(...,Type="Univariate") and HermiteN(...,Type="Multivariate") functions compute the univariate and d-variate Hermite polynomials and their inverses up to a given order N evaluated at x for a given covariance matrix Sig2. By default Sig2=Id.

Example 3 The first and the second 3-variate Hermite polynomials evaluated at x<-c(1,2,3) where x is the realization of X ∼ N(0, I3) is

x<-c(1,2,3)
H2<-HermiteN(x,N=2,Type="Multivariate")
H2[[1]]
#> [1] 1 2 3
H2[[2]]
#> [1] 0 2 3 2 3 6 3 6 8

If x is the realization of X ∼ N(0, 4I2)

H2<-HermiteN(x,Sig2=4*diag(3),N=2,Type="Multivariate")
H2[[1]]
#> [1] 1 2 3
H2[[2]]
#> [1] -3  2  3  2  0  6  3  6  5

One can recover the vector x from H2 with the inverse function:

HermiteN2X(H2,N=2,Sig2=4*diag(3),Type="Multivariate")[[1]] 
#> [1] 1 2 3

The function HermiteCov12 can be exploited to obtain the covariance matrix of HN(X1) and HN(X2) for vectors X1 and X2 having covariance matrix Σ12.

Covmat<-matrix(c(1,0.8,0.3,0.8,2,1,0.3,1,2),3,3)
Cov_X1_X2 <- HermiteCov12(SigX12=Covmat,N=3)

Multivariate T-moments and T-cumulants

Multivariate moments and cumulants of all orders of a random vector X in d-dimensions, with mean vector μ and covariance matrix Σ can be obtained by applying the T-derivative respectively to the characteristic function and the log of the CF.

More formally, let λ a d-vector of real constants; ϕX(λ) and ψX(λ) = log ϕX(λ) denote, respectively, the characteristic function and the cumulant- function of X.

Then the k-th order moments and cumulants of the vector X are obtained as μX, k = (−i)kDλkϕX(λ)|λ = 0. $$ \boldsymbol{\kappa}^\otimes_{\mathbf{X},k} = \underline{\operatorname{Cum}}_k(\mathbf{X})= (-\mathbf{i})^k D_{\boldsymbol{\lambda}}^{\otimes k}\boldsymbol{\boldsymbol{\psi}% }_{\mathbf{X}}(\boldsymbol{\lambda}) \big|_{\boldsymbol{\lambda}=0}. $$ Note that μX, k = E Xk that is a vector of dimension dk that contains all possible moments of order order k formed by X1, …, Xd. This approach has the advantage of being straightforwardly extendable to any k-th order moment. An analogous discussion can be done for cumulants.

Note that one has κX, 2 = vec Σ.

The package MultiStatM contains functions which obtains moments from cumulants and vice-versa as well as function which provide theoretical moments and cumulants for some important multivariate distributions.

The Cum2Mom and Mom2Cum either for the univariate and multivariate cases provide conversion formulae for cumlants from moments and viceversa given any list of (theoretical) moments (or cumulants).

The conversion formula from moments to cumulants (see Terdik (2001, 3.4)) is given by $$\begin{split} \boldsymbol{\mu}_{n}^\otimes &= \sum_{\cal{K} \in \cal{P}_n} \mathbf{K}^{-1}_{p(\cal{K})} \prod^\otimes_{b_j \in \cal{K}} \kappa^\otimes_{|b_j|}\\ &= \mathbf{S}_{d \mathbf{1}_n}\left( \sum_{r=1}^n \sum_{\sum l_j =r, \sum j l_j = n} \frac{n!}{\prod_{j=1}^n l_j! (j!)^{l_j}} \prod_{j=1:n-r+1}^\otimes \kappa^{\otimes l_j}_j\right) \end{split} $$ where the summation is over all partitions $\cal{K} = \{b_1, b_2,\dots, b_k\}$ of 1 : n; |bj| denotes the cardinality of block bj. The simpler second formula, exploiting the symmetrizer matrix, derives from symmetry of μn.

As far as the formula from cumulants to moments (Terdik (2021, 3.4)) is concerned, $$ \boldsymbol{\kappa}_{n}^\otimes = \mathbf{S}_{d \mathbf{1}_n}\left( \sum_{r=1}^n (-1)^{r-1} (r-1)!\sum_{\sum l_j =r, \sum j l_j = n} \prod_{j=1:n-r+1}^\otimes \frac{1}{{l_j}!}\left( \frac{1}{j!}\boldsymbol{\mu}^{\otimes}_j\right)^{l_j}\right) $$

Example 4. Consider the case of the 2-variate standard normal distribution with null mean vector and covariance matrix with unit elements on the main diagonal and off-diagonal elements equal to 0.5; in this case the the first four moments are given in the vector mu below

mu<-list(c(1,1),c(2,1.5,1.5,2),c(4,3,3,3,3,3,3,4),c(10,7,7,6.5,7,6.5,6.5,7,7,6.5,6.5,7,6.5,7,7,10))
cum<-Mom2Cum(mu, Type="Multivariate")
cum
#> [[1]]
#> [1] 1 1
#> 
#> [[2]]
#> [1] 1.0 0.5 0.5 1.0
#> 
#> [[3]]
#> [1] 0 0 0 0 0 0 0 0
#> 
#> [[4]]
#>  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Getting back to moments

Cum2Mom(cum,Type="Multivariate")
#> [[1]]
#> [1] 1 1
#> 
#> [[2]]
#> [1] 2.0 1.5 1.5 2.0
#> 
#> [[3]]
#> [1] 4 3 3 3 3 3 3 4
#> 
#> [[4]]
#>  [1] 10.0  7.0  7.0  6.5  7.0  6.5  6.5  7.0  7.0  6.5  6.5  7.0  6.5  7.0  7.0
#> [16] 10.0

I one wishes to select only the distinct moments from the vector of third moments, then

mu[[3]][EliminIndx(2,3)]
#> [1] 4 3 3 4

Alternatively one can also use the elimination matrix

r.mu<-EliminMatr(2,3)%*% mu[[3]]
c(r.mu)
#> [1] 4 3 3 4

Note that EliminMatr does not correspond the the function unique, rather it individuates the duplicated elements from the symmetry of the Kronecker product. This allow to recover the whole vector when needed.

c(QplicMatr(2,3)%*%r.mu)
#> [1] 4 3 3 3 3 3 3 4

The same result by using QplicIndx

r.mu[QplicIndx(2,3)]
#> [1] 4 3 3 3 3 3 3 4

The MomCum functions provide theoretical moments and cumulants for some common multivariate distributions: Skew-normal, Canonical Fundamental Skew-normal (CFUSN), Uniform distribution on the sphere, central folded Normal distribution (univariate and multivariate); for detail on the multivariate formulae used see @jamma2021San. Evaluation of theoretical moments and cumulants is done by the MomCumNAME group of functions. Some more details on the multivariate distributions considered are reported in the list below.

  • A d-vector U having uniform distribution on the sphere 𝕊d − 1. Moments and cumulants of all orders are provided for U by the function MomCumUniS; the function EVSKUniS can compute moments and cumulants (up to the 4th order), skewness, and kurtosis of U (Type="Standard") and its modulus (Type="Modulus"). Recall that any d-vector, say W, has a spherically symmetric distribution if that distribution is invariant under the group of rotations in d. This is equivalent to saying that W has the stochastic representation W = RU where R is a non negative random variable. Moments and cumulants of W can be obtained by its stochastic representation as discussed in @jamma2021San, Theorem 1 and Lemma 1. Furthermore a d-vector X has an elliptically symmetric distribution if it has the representation X = μ + Σ1/2W where μ ∈ ℝd, Σ is a variance-covariance matrix and W is spherically distributed. Hence the cumulants of X are just constant times the cumulants of W except for the mean i.e. $$ \underline{\operatorname*{Cum}}_{m}\left( \mathbf{X}\right) =\left( \boldsymbol{\Sigma}^{1/2}\right) ^{\otimes m}\underline{\operatorname*{Cum}% }_{m}\left( \mathbf{W}\right) . $$

  • If Z denotes a d-vector with d-variate standard normal distribution, the function MomCumZabs provide the moments and cumulants of |Z| respectively in the univariate (Type="univariate") and multivariate case (Type="Multivariate").

  • The multivariate skew-normal distribution introduced by @azzalini1996multivariate, whose marginal densities are scalar skew-normals. A d-dimensional random vector X is said to have a multivariate skew-normal distribution, SNd(μ, Ω, α) with shape parameter α if it has the density function 2φ(X; μ, Ω)Φ(α(X − μ)),  X ∈ ℝd, where φ(X; μ, Ω) is the d-dimensional normal density with mean μ and correlation matrix Ω; here φ and Φ denote the univariate standard normal density and the cdf. For a general formula for cumulants, see @jamma2021San, Lemma 4. For this distribution are available the functions MomCumSkewNorm, which computes the theoretical values of moments and cumulants up to the r-th order and EVSKSkewNorm which gives mean vector, covariance, skewness and kurtosis vectors and other measures.

  • @arellano2005fundamental introduced the CFUSN distribution (cf. their Proposition 2.3), to include all existing definitions of skew-normal distributions. The marginal stochastic representation of X with distribution CFUSNd, m(Δ) is given by X = Δ|Z1| + (Id − ΔΔ)1/2Z2 where Δ, is the d × m skewness matrix such that $\left\Vert \boldsymbol{\Delta}\underline{a}\right\Vert <1$, for all $\left\Vert \underline{a}\right\Vert =1$, and Z1 ∈ 𝒩(0, Im) and Z2 ∈ 𝒩(0, Id) are independent (Proposition 2.2. Arellano-Valle and Genton (2005)). A simple construction of Δ is Δ = Λ(Im+ΛΛ)−1/2 with some real matrix Λ with dimensions d × m. The CFUSNd, m(μ, Σ, Δ) can be defined via the linear transformation μ + Σ1/2X. For a general formula for cumulants, see @jamma2021San, Lemma 5. For this distributions MomCumCFUSN provides moments and cumulants up to the r-th order.

The Random generation family of functions in provide random number generators for multivariate distributions.

Example 5. For a skew-normal distribution with α = (10, 5, 0) and correlation function Ω = diag(1, 1, 1) we have the third moments and cumulants are

alpha<-c(10,5,0)
omega<-diag(3)
MSN<-MomCumSkewNorm(r=3,omega,alpha,nMu=TRUE)
round(MSN$Mu[[3]],3)
#>  [1] 1.568 0.073 0.000 0.073 0.570 0.000 0.000 0.000 0.711 0.073 0.570 0.000
#> [13] 0.570 0.996 0.000 0.000 0.000 0.355 0.000 0.000 0.711 0.000 0.000 0.355
#> [25] 0.711 0.355 0.000
round(MSN$CumX[[3]],3)
#>  [1] 0.154 0.077 0.000 0.077 0.039 0.000 0.000 0.000 0.000 0.077 0.039 0.000
#> [13] 0.039 0.019 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
#> [25] 0.000 0.000 0.000

As another example, for the Uniform distribution on the sphere, the fourth cumulant is:

EVSKUniS(3,  Type="Standard")$Kurt.U
#>  [1] -1.2  0.0  0.0  0.0 -0.4  0.0  0.0  0.0 -0.4  0.0 -0.4  0.0 -0.4  0.0  0.0
#> [16]  0.0  0.0  0.0  0.0  0.0 -0.4  0.0  0.0  0.0 -0.4  0.0  0.0  0.0 -0.4  0.0
#> [31] -0.4  0.0  0.0  0.0  0.0  0.0 -0.4  0.0  0.0  0.0 -1.2  0.0  0.0  0.0 -0.4
#> [46]  0.0  0.0  0.0  0.0  0.0 -0.4  0.0 -0.4  0.0  0.0  0.0 -0.4  0.0  0.0  0.0
#> [61] -0.4  0.0  0.0  0.0  0.0  0.0  0.0  0.0 -0.4  0.0 -0.4  0.0 -0.4  0.0  0.0
#> [76]  0.0 -0.4  0.0  0.0  0.0 -1.2

Estimation

Estimating functions starting from a vector of multivariate data are available: multivariate moments and cumulants, skewness and kurtosis vectors Mardia’s skewness and kurtosis indexes, Mori, Rohatgi, Szekely (MRSz’s) skewness vector and kurtosis matrices.

A complete picture of skewness is provided by the third-order T-cumulant (skewness vector) of a standardized X; set Y = Σ−1/2(X − μ), then the skewness vector is $$ \boldsymbol{\kappa}_{\mathbf{Y},3}^\otimes =\underline{\operatorname{Cum}}_3 \left( \mathbf{Y}\right)=\left(\mathbf{\Sigma}^{-1/2}\right)^{\otimes 3} \boldsymbol{\kappa}_{\mathbf{X},3}^\otimes. $$ The total skewness of X is defined by the square norm of the skewness vector: γ1, d = ∥κY, 32. This definition guarantees that skewness is invariant under the shifting and orthogonal transformations, in other words it is affine invariant.

We note that Mardia’s multivariate skewness index (Mardia (1970)), denote it by β1, d, coincides with the total skewness γ1, d since the third-order central moments and third-order cumulants are equal.

Mori, Rohatgi, Szekely (MRSz’s) skewness vector (Mori et al. (1994)) can also be recovered from the skewness vector as b(Y) = (vec ′Id ⊗ Id)κY, 3 Note that vec ′Id ⊗ Id is a matrix of dimension d × d3, which contains d unit values per-row, whereas all the others are 0; as a consequence, this measure does not take into account the contribution of cumulants of the type Cum3(Xj, Xk, Xl), where all the three indices j, k, l are different from each other. The corresponding scalar measure of multivariate skewness is b(Y) = ∥b(Y)∥2.

The fourth-order T-cumulant of the standardized X, i.e. κY, 4, will be called kurtosis vector of X; its square norm will be called the total kurtosis of X γ2, d = ∥κY, 42 Mardia’s kurtosis index β2, d = E (YY)2 is related to the kurtosis vector by the formula β2, d = (vec ′Id2)κY, 4 + d(d + 2) A consequence of this is that Mardia’s measure does not depend on all the entries of κY, 4 which has d(d + 1)(d + 2)(d + 3)/24 distinct elements, while β2, d includes only d2 elements among them. We note that if X is Gaussian, then κY, 4 = 0.

Cardoso, Mori, Szekely, Rothagi define what we will call the CMRS kurtosis matrix B(Y) = E (YYYY′) − (d + 2)Id which can be expressed in terms of the kurtosis vector as vec B(Y)(Id2 ⊗ vec ′Id)κY, 4 Note also that tr B(Y) = β2, d.

For further discussion on the above indexes and further multivariate indexes of skewness and kurtosis, as well as their asymptotic theory one can consult Terdik (2021, section 6) and Jammalamadaka et al. (2021a,b).

The function Esti_Variance_Skew_Kurt provides estimates of the covariance matrix of the data-estimated skewness and kurtosis vectors (Terdik (2021), formulae 6.13 and 6.22).

Example 6. Consider a multivariate data vector of dimension d = 3 and n = 250 from the multivariate skew-normal distribution of Example 5. The estimated first four cumulants are listed in the object EsMSN obtained by the SampleEVSK function; the corresponding theoretical values are in the object ThMSN obtained by the EVSKSkewNorm function.

data<-rSkewNorm(1000,omega,alpha)
EsMSN<-SampleEVSK(data)
ThMSN<-EVSKSkewNorm(omega,alpha)

Compare the distinct elements of the estimated skewness vector and the theoretical ones using Eliminindx.

EsMSN$estSkew[EliminIndx(3,3)]   
#>  [1]  0.68298356  0.44531338  0.05600283  0.16327647 -0.03763959  0.02253457
#>  [7]  0.11264519 -0.01802695 -0.05050936  0.06370048
ThMSN$SkewX[EliminIndx(3,3)]   
#>  [1] 0.68927167 0.34463583 0.00000000 0.17231792 0.00000000 0.00000000
#>  [7] 0.08615896 0.00000000 0.00000000 0.00000000

If one wishes to recover the estimated univariate skewness and kurtosis of the components X1, X2 and X3 of X, then, using UnivMomCum,

EsMSN$estSkew[UnivMomCum(3,3)]  ## Get univariate skewness for X1,X2,X3
#> [1] 0.68298356 0.11264519 0.06370048
EsMSN$estKurt[UnivMomCum(3,4)]  ## Get univariate kurtosis for X1,X2,X3
#> [1]  0.7319823 -0.1926749  0.1332520

An estimate of Mardia’s skewness index is provided together with the p-value under the null hypothesis of normality. The theoretical value of Mardia’s skewness can be recovered from the element SkewX.tot in the object ThMSN.

SampleSkew(data,Type="Mardia")
#> $Mardia.Skewness
#> [1] 1.186164
#> 
#> $p.value
#> [1] 4.882937e-37
ThMSN$SkewX.tot
#> [1] 0.9279208

The MRS skewness vector and index are provided together with the p-value for the skewness index under the null hypothesis of normality, The theoretical value, for the distribution at hand, can be computed using formula […]

SampleSkew(data,Type="MRSz")
#> $MRSz.Skewness.Vector
#> [1] 0.8687946 0.5074492 0.1016764
#> 
#> $MRSz.Skewness.Index
#> [1] 1.022647
#> 
#> $p.value
#> [1] 5.064019e-22
as.vector(t(c(diag(3))%x%diag(3))%*%ThMSN$SkewX)
#> [1] 0.8615896 0.4307948 0.0000000
c(t(c(diag(3))%x%diag(3))%*%ThMSN$SkewX)  ## Theoretical MRS skewness vector
#> [1] 0.8615896 0.4307948 0.0000000

Acknowledgement

This work has been partially supported by the project TKP2021-NKTA of the University of Debrecen, Hungary.

References

Arellano-Valle, R.B., Genton, M.G. (2005) On fundamental skew distributions. Journal of Multivariate Analysis 96(1), 93–116.

Azzalini, A. (2022). The R package ‘sn’: The Skew-Normal and Related Distributions such as the Skew-t and the SUN (version 2.0.2). URL http://azzalini.stat.unipd.it/SN/, https://cran.r-project.org/package=sn

Azzalini, A,, Dalla Valle, A. (1996) The multivariate skew-normal distribution. Biometrika 83(4), 715–726

Chacón, J. E., & Duong, T. (2015). Efficient recursive algorithms for functionals based on higher order derivatives of the multivariate Gaussian density. Statistics and Computing, 25(5), 959-974.

Di Nardo, E. and Guarino, G. (2022). kStatistics: Unbiased Estimators for Cumulant Products and Faa Di Bruno’s Formula. R package version 2.1.1. https://CRAN.R-project.org/package=kStatistics

Franceschini, C. and Loperfido, N. (2017a). MultiSkew: Measures, Tests and Removes Multivariate Skewness. R package version 1.1.1. https://CRAN.R-project.org/package=MultiSkew

Franceschini, C. and Loperfido, N. (2017b). MaxSkew: Orthogonal Data Projections with Maximal Skewness. R package version 1.1. https://CRAN.R-project.org/package=MaxSkew

Holmquist, B. (1996). The d-variate vector Hermite polynomial of order. Linear Algebra and Its Applications, 237/238, 155–190.

Jammalamadaka, S. R., Subba Rao, T. and Terdik, Gy. (2006). Higher order cumulants of random vectors and applications to statistical inference and time series. Sankhya A, 68, 326–356.

Jammalamadaka, S. R., Taufer, E. & Terdik, Gy. H. (2021a). On multivariate skewness and kurtosis. Sankhya A, 83(2), 607-644.

Jammalamadaka, S. R., Taufer, E. & Terdik, Gy. H. (2021b). Asymptotic theory for statistics based on cumulant vectors with applications. Scandinavian Journal of Statistics, 48(2), 708-728.

Jammalamadaka,S.R. , Taufer,E. & Terdik, Gy. (2021c). Cumulants of Multivariate Symmetric and Skew Symmetric Distributions, Symmetry 13, 1383.

Kolda, T.G.; Bader, B.W. (2009). Tensor decompositions and applications. SIAM Rev. 51, 455–500.

Kollo, T. (2008). Multivariate skewness and kurtosis measures with an application in ICA. Journal of Multivariate Analysis 99(10), 2328–2338.

Komsta, L. and Novomestky F. (2022). moments: Moments, Cumulants, Skewness, Kurtosis and Related Tests. R package version 0.14.1. https://CRAN.R-project.org/package=moments

Novomestky, F. (2021). matrixcalc: Collection of Functions for Matrix Calculations. R package version 1.0-5. https://CRAN.R-project.org/package=matrixcalc

Qi, L. (2006). Rank and eigenvalues of a supersymmetric tensor, the multivariate homogeneous polynomial and the algebraic hypersurface it defines. J. Symb. Comput. 41, 1309–1327.

Mardia, K. V. (1970). Measures of multivariate skewness and kurtosis with applications. Biometrika, 57, 519–530.

McCullagh, P. (2018). Tensor methods in statistics. Chapman and Hall/CRC.

Móri, T. F., Rohatgi, V. K., & Székely, G. J. (1994). On multivariate skewness and kurtosis. Theory of Probability & Its Applications, 38(3), 547–551.

Ould-Baba, H.; Robin, V.; Antoni, J. (2015). Concise formulae for the cumulant matrices of a random vector. Linear Algebra Appl. 485, 392–416.

Terdik, Gy. (2021). Multivariate statistical methods - going beyond the linear. Springer.