The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: Matrix Normal Distribution
Version: 1.0
Date: 2024-05-21
Author: Michail Tsagris [aut, cre], Alzeley Omar [ctb]
Maintainer: Michail Tsagris <mtsagris@uoc.gr>
Depends: R (≥ 4.0)
Imports: Rfast
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.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
NeedsCompilation: no
Packaged: 2024-05-21 11:55:32 UTC; mtsag
Repository: CRAN
Date/Publication: 2024-05-22 12:20:10 UTC

Matrix Normal Distribution

Description

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.

Details

Package: MN
Type: Package
Version: 1.0
Date: 2024-05-21

Maintainers

Michail Tsagris <mtsagris@uoc.gr>.

Author(s)

Michail Tsagris mtsagris@uoc.gr and Omar Alzeley oazeley@uqu.edu.sa

References

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

Description

Density of the matrix normal distribution.

Usage

dmn(X, M, U, V, logged = FALSE)

Arguments

X

A list with k elements, k matrices of dimension n \ times p each. In the case of one matrix only, this may be given as a numerical matrix and not as an element in a list.

M

The mean matrix of the distribution, a numerical matrix of dimensions n \times p.

U

The covariance matrix associated with the rows, a numerical matrix of dimensions n \times n.

V

The covariance matrix associated with the columns, a numerical matrix of dimensions p \times p.

logged

Should the logarithm of the density be computed?

Value

A numeric vector with the (logged) density values.

Author(s)

Omar Alzeley.

R implementation and documentation: Omar Alzeley oazeley@uqu.edu.sa.

References

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.

See Also

rmn, mn.mle, ddplot

Examples

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

Description

Distance-Distance Plot

Usage

ddplot(X, M, U, V)

Arguments

X

A list with k elements, k matrices of dimension n \ times p each. In the case of one matrix only, this may be given as a numerical matrix and not as an element in a list.

M

The mean matrix of the distribution, a numerical matrix of dimensions n \times p.

U

The covariance matrix associated with the rows, a numerical matrix of dimensions n \times n.

V

The covariance matrix associated with the columns, a numerical matrix of dimensions p \times p.

Details

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.

Value

A scatter plot of the Mahalanobis distances.

Author(s)

Michail Tsagris and Omar Alzeley.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr and Omar Alzeley oazeley@uqu.edu.sa.

References

Pocuca N., Gallaugher M. P., Clark K. M. & McNicholas P. D. (2019). Assessing and Visualizing Matrix Variate Normality. arXiv:1910.02859.

See Also

rmn, mn.mle, dmn, ddkstest

Examples

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

Description

Kolmogorov-Smirnov test for matrix normality

Usage

ddkstest(X, M, U, V, alpha = 0.05)

Arguments

X

A list with k elements, k matrices of dimension n \ times p each. In the case of one matrix only, this may be given as a numerical matrix and not as an element in a list.

M

The mean matrix of the distribution, a numerical matrix of dimensions n \times p.

U

The covariance matrix associated with the rows, a numerical matrix of dimensions n \times n.

V

The covariance matrix associated with the columns, a numerical matrix of dimensions p \times p.

alpha

The significance level for the test, set by default equal to 0.05.

Details

The Kolmogorov-Smirnov test for matrix normality is performed. See Pocuca (2019) for more details.

Value

A message. If the Kronecker product covariance structure is not present, the message reads "Reject" and "Not reject otherwise".

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Pocuca N., Gallaugher M. P., Clark K. M. & McNicholas P. D. (2019). Assessing and Visualizing Matrix Variate Normality. arXiv:1910.02859.

See Also

rmn, mn.mle, dmn, ddplot

Examples

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

Description

Maximum likelihood estimation of the the matrix normal distribution.

Usage

mn.mle(X)

Arguments

X

A list with k elements (k is the sample size), k matrices of dimension n \ times p each.

Value

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 n \times p.

U

The estimated covariance matrix associated with the rows, a numerical matrix of dimensions n \times n.

V

The estimated covariance matrix associated with the columns, a numerical matrix of dimensions p \times p.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

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.

See Also

dmn, rmn, ddplot

Examples

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

Description

Random matrices simulation from the matrix normal distribution.

Usage

rmn(k, M, U, V)

Arguments

k

The sample size, the number of matrices to simulate.

M

The mean matrix of the distribution, a numerical matrix of dimensions n \times p.

U

The covariance matrix associated with the rows, a numerical matrix of dimensions n \times n.

V

The covariance matrix associated with the columns, a numerical matrix of dimensions p \times p.

Value

A list with k elements, k matrices of dimension n \ times p each. These are the random matrices drawn from a matrix normal distribution.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

https://en.wikipedia.org/wiki/Matrix_normal_distribution#Definition

See Also

dmn, mn.mle, ddplot

Examples

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)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.