Title: | Matrix Normal Distribution |
---|---|
Description: | Density computation, random matrix generation and maximum likelihood estimation of the matrix normal distribution. References: Pocuca N., Gallaugher M. P., Clark K. M. & McNicholas P. D. (2019). Assessing and Visualizing Matrix Variate Normality. <doi:10.48550/arXiv.1910.02859> and the relevant wikipedia page. |
Authors: | Michail Tsagris [aut, cre], Alzeley Omar [ctb] |
Maintainer: | Michail Tsagris <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0 |
Built: | 2024-12-04 07:31:22 UTC |
Source: | CRAN |
Density computation, random matrix generation and maximum likelihood estimation of the matrix normal distribution. For references see: Pocuca N., Gallaugher M. P., Clark K. M. & McNicholas P. D. (2019). Assessing and Visualizing Matrix Variate Normality. arXiv:1910.02859 and the relevant wikipedia page.
Package: | MN |
Type: | Package |
Version: | 1.0 |
Date: | 2024-05-21 |
Michail Tsagris <[email protected]>.
Michail Tsagris [email protected] and Omar Alzeley [email protected]
Pocuca, N., Gallaugher, M. P., Clark, K. M., & McNicholas, P. D. (2019). Assessing and Visualizing Matrix Variate Normality. arXiv:1910.02859.
Density of the matrix normal distribution.
dmn(X, M, U, V, logged = FALSE)
dmn(X, M, U, V, logged = FALSE)
X |
A list with k elements, k matrices of dimension |
M |
The mean matrix of the distribution, a numerical matrix of dimensions |
U |
The covariance matrix associated with the rows, a numerical matrix of dimensions |
V |
The covariance matrix associated with the columns, a numerical matrix of dimensions |
logged |
Should the logarithm of the density be computed? |
A numeric vector with the (logged) density values.
Omar Alzeley.
R implementation and documentation: Omar Alzeley [email protected].
https://en.wikipedia.org/wiki/Matrix_normal_distribution#Definition
Pocuca, N., Gallaugher, M. P., Clark, K. M., & McNicholas, P. D. (2019). Assessing and Visualizing Matrix Variate Normality. arXiv:1910.02859.
M <- as.matrix(iris[1:8, 1:4]) U <- cov( matrix( rnorm(100 * 8), ncol = 8 ) ) V <- cov( iris[1:50, 1:4] ) X <- rmn(10, M, U, V) dmn(X, M, U, V, TRUE)
M <- as.matrix(iris[1:8, 1:4]) U <- cov( matrix( rnorm(100 * 8), ncol = 8 ) ) V <- cov( iris[1:50, 1:4] ) X <- rmn(10, M, U, V) dmn(X, M, U, V, TRUE)
Distance-Distance Plot
ddplot(X, M, U, V)
ddplot(X, M, U, V)
X |
A list with k elements, k matrices of dimension |
M |
The mean matrix of the distribution, a numerical matrix of dimensions |
U |
The covariance matrix associated with the rows, a numerical matrix of dimensions |
V |
The covariance matrix associated with the columns, a numerical matrix of dimensions |
The distance-distance plot is produced. This is a scatter plot of the Mahalanobis distances computed using the estimated parameters from the multivariate normal and matrix normal distribution. See Pocuca et al. (2019) for more details.
A scatter plot of the Mahalanobis distances.
Michail Tsagris and Omar Alzeley.
R implementation and documentation: Michail Tsagris [email protected] and Omar Alzeley [email protected].
Pocuca N., Gallaugher M. P., Clark K. M. & McNicholas P. D. (2019). Assessing and Visualizing Matrix Variate Normality. arXiv:1910.02859.
M <- as.matrix(iris[1:8, 1:4]) U <- cov( matrix( rnorm(100 * 8), ncol = 8 ) ) V <- cov( iris[1:50, 1:4] ) X <- rmn(100, M, U, V) ddplot(X, M, U, V)
M <- as.matrix(iris[1:8, 1:4]) U <- cov( matrix( rnorm(100 * 8), ncol = 8 ) ) V <- cov( iris[1:50, 1:4] ) X <- rmn(100, M, U, V) ddplot(X, M, U, V)
Kolmogorov-Smirnov test for matrix normality
ddkstest(X, M, U, V, alpha = 0.05)
ddkstest(X, M, U, V, alpha = 0.05)
X |
A list with k elements, k matrices of dimension |
M |
The mean matrix of the distribution, a numerical matrix of dimensions |
U |
The covariance matrix associated with the rows, a numerical matrix of dimensions |
V |
The covariance matrix associated with the columns, a numerical matrix of dimensions |
alpha |
The significance level for the test, set by default equal to 0.05. |
The Kolmogorov-Smirnov test for matrix normality is performed. See Pocuca (2019) for more details.
A message. If the Kronecker product covariance structure is not present, the message reads "Reject" and "Not reject otherwise".
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
Pocuca N., Gallaugher M. P., Clark K. M. & McNicholas P. D. (2019). Assessing and Visualizing Matrix Variate Normality. arXiv:1910.02859.
M <- as.matrix(iris[1:8, 1:4]) U <- cov( matrix( rnorm(100 * 8), ncol = 8 ) ) V <- cov( iris[1:50, 1:4] ) X <- rmn(200, M, U, V) ddkstest(X, M, U, V)
M <- as.matrix(iris[1:8, 1:4]) U <- cov( matrix( rnorm(100 * 8), ncol = 8 ) ) V <- cov( iris[1:50, 1:4] ) X <- rmn(200, M, U, V) ddkstest(X, M, U, V)
Maximum likelihood estimation of the the matrix normal distribution.
mn.mle(X)
mn.mle(X)
X |
A list with k elements (k is the sample size), k matrices of dimension |
A list including:
runtime |
The runtime required for the whole fitting procedure. |
iters |
The number of iterations required for the estimation of the U and V matrices. |
M |
The estimated mean matrix of the distribution, a numerical matrix of dimensions |
U |
The estimated covariance matrix associated with the rows, a numerical matrix of dimensions |
V |
The estimated covariance matrix associated with the columns, a numerical matrix of dimensions |
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
https://en.wikipedia.org/wiki/Matrix_normal_distribution#Definition
Pocuca N., Gallaugher M. P., Clark K. M. & McNicholas P. D. (2019). Assessing and Visualizing Matrix Variate Normality. arXiv:1910.02859.
M <- as.matrix(iris[1:8, 1:4]) U <- cov( matrix( rnorm(100 * 8), ncol = 8 ) ) V <- cov( iris[1:50, 1:4] ) X <- rmn(200, M, U, V) mod <- mn.mle(X)
M <- as.matrix(iris[1:8, 1:4]) U <- cov( matrix( rnorm(100 * 8), ncol = 8 ) ) V <- cov( iris[1:50, 1:4] ) X <- rmn(200, M, U, V) mod <- mn.mle(X)
Random matrices simulation from the matrix normal distribution.
rmn(k, M, U, V)
rmn(k, M, U, V)
k |
The sample size, the number of matrices to simulate. |
M |
The mean matrix of the distribution, a numerical matrix of dimensions |
U |
The covariance matrix associated with the rows, a numerical matrix of dimensions |
V |
The covariance matrix associated with the columns, a numerical matrix of dimensions |
A list with k elements, k matrices of dimension each. These are the random matrices drawn from a matrix normal distribution.
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
https://en.wikipedia.org/wiki/Matrix_normal_distribution#Definition
M <- as.matrix(iris[1:8, 1:4]) U <- cov( matrix( rnorm(100 * 8), ncol = 8 ) ) V <- cov( iris[1:50, 1:4] ) X <- rmn(10, M, U, V)
M <- as.matrix(iris[1:8, 1:4]) U <- cov( matrix( rnorm(100 * 8), ncol = 8 ) ) V <- cov( iris[1:50, 1:4] ) X <- rmn(10, M, U, V)