Developer Reference for Intel® oneAPI Math Kernel Library for C
Summary Statistics Mathematical Notation and Definitions
The following notations are used in the mathematical definitions and the description of the Intel® oneAPI Math Kernel Library (oneMKL) Summary Statistics functions.
Matrix and Weights of Observations
For a random p-dimensional vector \(\xi = ( \xi_1 ,\dots, \xi_i ,\dots, \xi_p )\), this manual denotes the following:
\((X)_{i}=(x_{ij})_{j=1..n}\) is the result of n independent observations for the i-th component \(\xi_i\) of the vector \(\xi\).
The two-dimensional array \(X=(x_{ij})_{n \times p}\) is the matrix of observations.
The column \([X]_{j}=(x_{ij})_{i=1..p}\) of the matrix \(X\) is the j-th observation of the random vector \(\xi\).
Each observation \([X]_{j}\) is assigned a non-negative weight \(\omega_{j}\) , where
The vector \((\omega_j)_{j=1..n}\) is a vector of weights corresponding to n observations of the random vector \(\xi\).
\(W = \sum_{j=1}^n \omega_j\) is the accumulated weight corresponding to observations X.
Vector of sample means
\(M(X) = \left( M_1(X), \; \dots, M_p(X) \right), \; M_i(X) = \frac{1}{W} \sum_{j=1}^n \omega_j x_{ij}\)
for all \(i = 1, \dots, p\) .
Vector of sample partial sums
\(S(X) = \left( S_1(X), \; \dots, S_p(X) \right), \; S_i(X) = \sum_{j=1}^n \omega_j x_{ij}\)
for all \(i = 1, \dots, p\) .
Vector of sample variances
\(V(X) = \left( V_1(X), \; \dots, V_p(X) \right)\), \(V_i(X) = \frac{1}{B} \sum_{j=1}^n \omega_j (x_{ij} - M_i(X))^2\), \(B = W - \sum_{j=1}^n \frac{\omega_j^2}{W}\)
for all \(i = 1, \dots, p\).
Vector of sample raw/algebraic moments of k-th order, \(k \ge 1\)
\(R^{(k)}(X) = \left( R_1^{(k)}(X), \; \dots, R_p^{(k)}(X) \right)\), \(R_i^{(k)}(X) = \frac{1}{W} \sum_{j=1}^n \omega_j x_{ij}^k\)
for all \(i = 1, \dots, p\).
Vector of sample raw/algebraic partial sums of k-th order, k = 2, 3, 4 (raw/algebraic partial sums of squares/cubes/fourth powers)
\(S^k(X) = \left( S_1^k(X), \; \dots, S_p^k(X) \right), \; S_i^k(X) = \sum_{j=1}^n \omega_j x^k_{ij}\)
for all \(i = 1, \dots, p\).
Vector of sample central moments of the third and the fourth order
\(C^{(k)}(X) = \left( C_1^{(k)}(X), \; \dots, C_p^{(k)}(X) \right)\), \(C_i^{(k)}(X) = \frac{1}{W} \sum_{j=1}^{n} \omega_j \left( x_{ij} - M_i(X) \right)^k\)
for all \(i = 1, \dots, p, \; k = 3, 4\).
Vector of sample central partial sums of k-th order, k = 2, 3, 4 (central partial sums of squares/cubes/fourth powers)
\(S^k(X) = \left( S_1^k(X), \; \dots, S_p^k(X) \right), \; S_i^k(X) = \sum_{j=1}^{n} \omega_j \left( x_{ij} - S_i(X) \right)^k\)
Where:
\(S_i(X) = \sum_{j=1}^n \omega_j x_{ij}, \; i = 1, \dots, p\)
Vector of sample excess kurtosis values
\(B(X) = \left( B_1(X), \; \dots, B_p(X) \right), \; B_i(X) = \frac{C_i^{(4)}(X)}{V_i^2(X)} - 3\)
for all \(i = 1, \dots, p\).
Vector of sample skewness values
\(\Gamma(X) = \left( \Gamma_1(X), \; \dots, \Gamma_p(X) \right), \; \Gamma_i(X) = \frac{C_i^{(3)}(X)}{V_i^{1.5}(X)}\)
for all \(i = 1, \dots, p\) .
Vector of sample variation coefficients
\(VC(X) = \left( VC_1(X), \; \dots, VC_p(X) \right), \; VC_i(X) = \frac{V_i^{0.5}(X)}{M_i(X)}\)
for all \(i = 1, \dots, p\) .
Matrix of order statistics
Matrix \(Y = (y_{ij})_{p \times n}\) , in which the i-th row \((Y)_{i} = (y_{ij})_{j=1..n}\) is obtained as a result of sorting in the ascending order of row \((X)_{i} = (x_{ij})_{j=1..n}\) in the original matrix of observations.
Vector of sample minimum values
\(\min(X) = \left( {\min}_1(X), \; \dots, {\min}_p(X) \right), {\min}_i(X) = y_{i1}\)
for all \(i = 1, \dots, p\).
Vector of sample maximum values
\(\max(X) = \left( {\max}_1(X), \; \dots, {\max}_p(X) \right), {\max}_i(X) = y_{in}\)
for all \(i = 1, \dots, p\).
Vector of sample median values
\(\text{Med}(X) = \left( \text{Med}_1(X), \; \dots, \text{Med}_p(X) \right)\), where \(\text{Med}_i(X) = \begin{cases} y_{i,(n+1)/2}, & \text{if } n \text{ is odd} \\ \frac{y_{i,n/2} + y_{i,n/2+1}}{2}, & \text{if } n \text{ is even} \end{cases}\)
for all \(i = 1, \dots, p\) .
Vector of sample median absolute deviations
\(\text{MDAD}(X) = \left( \text{MDAD}_1(X), \; \dots, \text{MDAD}_p(X) \right)\), where \(\text{MDAD}_i(X) = \text{Med}_i(Z)\), \(Z = (z_{ij})_{i=1..p, j=1..n}\), \(z_{ij} = \left|x_{ij} - \text{Med}_i(X)\right|\)
for all \(i = 1, \dots, p\).
Vector of sample mean absolute deviations
\(\text{MNAD}(X) = \left( \text{MNAD}_1(X), \; \dots, \text{MNAD}_p(X) \right)\), where \(\text{MNAD}_i(X) = M_i(Z)\), \(Z = (z_{ij})_{i=1..p, j=1..n}\), \(z_{ij} = \left|x_{ij} - M_i(X)\right|\)
for all \(i = 1, \dots, p\).
Vector of sample quantile values
For a positive integer number q and k belonging to the interval \([0, q -1]\), point \(z_i\) is the k-th q quantile of the random variable \(\xi_i\) if \(P\left\{\xi_{i} \le z_{i}\right\} \ge \beta\) and \(P\left\{\xi_{i} \ge z_{i}\right\} \ge 1 - \beta\), where
P is the probability measure.
\(\beta = k / q\) is the quantile order.
The calculation of quantiles is as follows:
\(j = \left[(n - 1) \beta \right]\) and \(f = \left\{(n - 1) \beta \right\}\) as integer and fractional parts of the number \((n - 1) \beta\), respectively, and the vector of sample quantile values is \(Q(X,\beta) = (Q_{1}(X,\beta), \dots, Q_{p}(X,\beta))\), where \(Q_{i}\left(X,\beta\right) = y_{i,j+1} + f\left(y_{i,j+2} - y_{i,j+1}\right)\) for all \(i = 1, \dots, p\).
Variance-covariance matrix
\(C(X) = (c_{ij}(X))_{p \times p}\)
where
\(c_{ij}(X) = \frac{1}{B} \sum_{k=1}^n \omega_k (x_{ik} - M_i(X))(x_{jk} - M_j(X))\), \(B = W - \sum_{j=1}^n \frac{\omega_j^2}{W}\)
Cross-product matrix (matrix of cross-products and sums of squares)
\(CP(X) = (cp_{ij}(X))_{p \times p}\), where \(cp_{ij}(X) = \sum_{k=1}^n \omega_k (x_{ik} - M_i(X))(x_{jk} - M_j(X))\)
Pooled and group variance-covariance matrices
The set \(N = \{1, \dots, n\}\) is partitioned into non-intersecting subsets
\(G_i, i = 1..g, N = \bigcup_{i=1}^g G_i\).
The observation \([X]_{j} = (x_{ij})_{i=1..p}\) belongs to the group \(r\) if \(j \in G_r\). One observation belongs to one group only. The group mean and variance-covariance matrices are calculated similarly to the formulas above:
\(M^{(r)}(X) = (M_1^{(r)}(X), \dots, M_p^{(r)}(X))\) with \(M_i^{(r)}(X) = \frac{1}{W^{(r)}} \sum_{j \in G_r} \omega_j x_{ij}\), \(W^{(r)} = \sum_{j \in G_r} \omega_j\)
for all \(i = 1, \dots, p\),
\(C^{(r)}(X) = \left(c_{ij}^{(r)}(X)\right)_{p \times p}\)
where
\(c_{ij}^{(r)}(X) = \frac{1}{B^{(r)}} \sum_{k \in G_r} \omega_k (x_{ik} - M_i^{(r)}(X))(x_{jk} - M_j^{(r)}(X))\), \(B^{(r)} = W^{(r)} - \sum_{j \in G_r} \frac{\omega_j^2}{W^{(r)}}\)
for all \(i = 1, \dots, p\) and \(j = 1, \dots, p\).
A pooled variance-covariance matrix and a pooled mean are computed as weighted mean over group covariance matrices and group means, correspondingly:
\(M^{\text{pooled}}(X) = \left( M_1^{\text{pooled}}(X), \dots, M_p^{\text{pooled}}(X) \right)\) with \(M_i^{\text{pooled}}(X) = \frac{1}{W^{(1)} + \dots + W^{(g)}} \sum_{r=1}^g W^{(r)} M_i^{(r)}(X)\)
for all \(i = 1, \dots, p\),
\(C^{\text{pooled}}(X) = \left(c_{ij}^{\text{pooled}}(X)\right)_{p \times p}\), \(c_{ij}^{\text{pooled}}(X) = \frac{1}{B^{(1)} + \dots + B^{(g)}} \sum_{r=1}^g B^{(r)} c_{ij}^{(r)}(X)\)
for all \(i = 1, \dots, p\) and \(j = 1, \dots, p\).
Correlation matrix
\(R(X) = \left(r_{ij}(X)\right)_{p \times p}\), where \(r_{ij}\left(X\right) = \frac{c_{ij}\left(X\right)}{\sqrt{c_{ii}\left(X\right)c_{jj}\left(X\right)}}\)
for all \(i = 1, \dots, p\) and \(j = 1, \dots, p\).
Partial variance-covariance matrix
For a random vector \(\xi\) partitioned into two components Z and Y, a variance-covariance matrix C describes the structure of dependencies in the vector \(\xi\):
\(C = \begin{pmatrix} C_{Z}\left(X\right) & C_{ZY}\left(X\right) \\ C_{YZ}\left(X\right) & C_{Y}\left(X\right) \end{pmatrix}\)
The partial covariance matrix \(P(X) = (p_{ij}(X))_{k \times k}\) is defined as
\(P\left(X\right) = C_{Y}\left(X\right) - C_{YZ}\left(X\right) C_{Z}^{-1}\left(X\right) C_{ZY}\left(X\right)\),
where k is the dimension of Y.
Partial correlation matrix
The following is a partial correlation matrix for all \(i = 1, \dots, k\) and \(j = 1, \dots, k\):
\(RP(X) = \left(rp_{ij}\left(X\right)\right)_{k \times k}\), where \(rp_{ij}\left(X\right) = \frac{p_{ij}\left(X\right)}{\sqrt{p_{ii}\left(X\right) p_{jj}\left(X\right)}}\)
where
k is the dimension of Y.
\(p_{ij}\left(X\right)\) are elements of the partial variance-covariance matrix.
Sorted dataset
Matrix \(Y = (y_{ij})_{p \times n}\), in which the i-th row \((Y)_i\) is obtained as a result of sorting in ascending order the row \((X)_i = (x_{ij})_{j=1..n}\) in the original matrix of observations.