| Title: | Random Wishart Matrix Generation |
|---|---|
| Description: | An expansion of R's 'stats' random wishart matrix generation. This package allows the user to generate singular, Uhlig and Harald (1994) <doi:10.1214/aos/1176325375>, and pseudo wishart, Diaz-Garcia, et al.(1997) <doi:10.1006/jmva.1997.1689>, matrices. In addition the user can generate wishart matrices with fractional degrees of freedom, Adhikari (2008) <doi:10.1061/(ASCE)0733-9399(2008)134:12(1029)>, commonly used in volatility modeling. Users can also use this package to create random covariance matrices. |
| Authors: | Ben Barnard [aut, cre], Dean Young [aut] |
| Maintainer: | Ben Barnard <[email protected]> |
| License: | GPL-2 |
| Version: | 0.1.2 |
| Built: | 2026-06-05 10:08:28 UTC |
| Source: | https://github.com/benbarnard/rwishart |
Generate n random matrices, distributed according to the Wishart distribution with parameters Sigma and df, W_p(Sigma, df).
rFractionalWishart(n, df, Sigma, covariance = FALSE, simplify = "array")rFractionalWishart(n, df, Sigma, covariance = FALSE, simplify = "array")
n |
integer: the number of replications. |
df |
numeric parameter, “degrees of freedom”. |
Sigma |
positive definite ( |
covariance |
logical on whether a covariance matrix should be generated |
simplify |
logical or character string; should the result be
simplified to a vector, matrix or higher dimensional array if
possible? For |
If X_1, ..., X_m is a sample of m independent multivariate Gaussians with mean vector 0, and covariance matrix Sigma, the distribution of M = X'X is W_p(Sigma, m).
A numeric array of dimension p * p * n, where each array is a positive semidefinite matrix, a realization of the Wishart distribution W_p(Sigma, df)
Adhikari, S. (2008). Wishart random matrices in probabilistic structural mechanics. Journal of engineering mechanics, 134(12), doi:10.1061/(ASCE)0733-9399(2008)134:12(1029).
rFractionalWishart(2, 22.5, diag(1, 20))rFractionalWishart(2, 22.5, diag(1, 20))
Generate n random matrices, distributed according to the Wishart distribution with parameters Sigma and df, W_p(Sigma, df).
rNonsingularWishart(n, df, Sigma, covariance = FALSE, simplify = "array")rNonsingularWishart(n, df, Sigma, covariance = FALSE, simplify = "array")
n |
integer: the number of replications. |
df |
numeric parameter, “degrees of freedom”. |
Sigma |
positive definite ( |
covariance |
logical on whether a covariance matrix should be generated |
simplify |
logical or character string; should the result be
simplified to a vector, matrix or higher dimensional array if
possible? For |
If X_1, ..., X_m is a sample of m independent multivariate Gaussians with mean vector 0, and covariance matrix Sigma, the distribution of M = X'X is W_p(Sigma, m).
A numeric array of dimension p * p * n, where each array is a positive semidefinite matrix, a realization of the Wishart distribution W_p(Sigma, df)
rNonsingularWishart(2, 20, diag(1, 5))rNonsingularWishart(2, 20, diag(1, 5))
Generate n random matrices, distributed according to the Wishart distribution with parameters Sigma and df, W_p(Sigma, df).
rPsuedoWishart(n, df, Sigma, covariance = FALSE, simplify = "array")rPsuedoWishart(n, df, Sigma, covariance = FALSE, simplify = "array")
n |
integer: the number of replications. |
df |
numeric parameter, “degrees of freedom”. |
Sigma |
positive definite ( |
covariance |
logical on whether a covariance matrix should be generated |
simplify |
logical or character string; should the result be
simplified to a vector, matrix or higher dimensional array if
possible? For |
If X_1, ..., X_m is a sample of m independent multivariate Gaussians with mean vector 0, and covariance matrix Sigma, the distribution of M = X'X is W_p(Sigma, m).
A numeric array of dimension p * p * n, where each array is a positive semidefinite matrix, a realization of the Wishart distribution W_p(Sigma, df)
Diaz-Garcia, Jose A, Ramon Gutierrez Jaimez, and Kanti V Mardia. 1997. “Wishart and Pseudo-Wishart Distributions and Some Applications to Shape Theory.” Journal of Multivariate Analysis 63 (1): 73–87. doi:10.1006/jmva.1997.1689.
rPsuedoWishart(2, 5, diag(1, 20))rPsuedoWishart(2, 5, diag(1, 20))
Generate n random matrices, distributed according to the Wishart distribution with parameters Sigma and df, W_p(Sigma, df).
rSingularWishart(n, df, Sigma, covariance = FALSE, simplify = "array")rSingularWishart(n, df, Sigma, covariance = FALSE, simplify = "array")
n |
integer: the number of replications. |
df |
numeric parameter, “degrees of freedom”. |
Sigma |
positive definite ( |
covariance |
logical on whether a covariance matrix should be generated |
simplify |
logical or character string; should the result be
simplified to a vector, matrix or higher dimensional array if
possible? For |
If X_1, ..., X_m is a sample of m independent multivariate Gaussians with mean vector 0, and covariance matrix Sigma, the distribution of M = X'X is W_p(Sigma, m).
A numeric array of dimension p * p * n, where each array is a positive semidefinite matrix, a realization of the Wishart distribution W_p(Sigma, df)
Uhlig, Harald. 1994. “On Singular Wishart and Singular Multivariate Beta Distributions.” The Annals of Statistics 22 (1): 395–405. doi:10.1214/aos/1176325375.
rSingularWishart(2, 5, diag(1, 20))rSingularWishart(2, 5, diag(1, 20))
An expansion of R's 'stats' random wishart matrix generation. This package allows the user to generate singular, Uhlig and Harald (1994) <doi:10.1214/aos/1176325375>, and pseudo wishart, Diaz-Garcia, et al.(1997) <doi:10.1006/jmva.1997.1689>, matrices. In addition the user can generate wishart matrices with fractional degrees of freedom, Adhikari (2008) <doi:10.1061/(ASCE)0733-9399(2008)134:12(1029)>, commonly used in volatility modeling. Users can also use this package to create random covariance matrices.
Generate n random matrices, distributed according to the Wishart distribution with parameters Sigma and df, W_p(Sigma, df).
rWishart(n, df, Sigma, covariance = FALSE, simplify = "array")rWishart(n, df, Sigma, covariance = FALSE, simplify = "array")
n |
integer: the number of replications. |
df |
numeric parameter, “degrees of freedom”. |
Sigma |
positive definite ( |
covariance |
logical on whether a covariance matrix should be generated |
simplify |
logical or character string; should the result be
simplified to a vector, matrix or higher dimensional array if
possible? For |
If X_1, ..., X_m is a sample of m independent multivariate Gaussians with mean vector 0, and covariance matrix Sigma, the distribution of M = X'X is W_p(Sigma, m).
A numeric array of dimension p * p * n, where each array is a positive semidefinite matrix, a realization of the Wishart distribution W_p(Sigma, df)
rWishart(2, 5, diag(1, 20))rWishart(2, 5, diag(1, 20))
Given a random Wishart matrix, B, from W_p(Sigma, df) and independent random vector a, then (a' B a) / (a' Sigma a)
is chi-squared with df degrees of freedom.
wishartTest(WishMat, Sigma, vec = NULL)wishartTest(WishMat, Sigma, vec = NULL)
WishMat |
random Wishart Matrix from W_p(Sigma, df) |
Sigma |
Covariance matrix for W_p(Sigma, df) |
vec |
independent random vector |
A chi-squared random variable with df degrees of freedom.
wishartTest(rWishart(1, 5, diag(1, 20), simplify = FALSE)[[1]], diag(1, 20))wishartTest(rWishart(1, 5, diag(1, 20), simplify = FALSE)[[1]], diag(1, 20))