Description Usage Arguments Value References See Also Examples
Density and random generation for the matrix variate normal distribution
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
n |
number of observations to generate - must be a positive integer. |
mean |
p * q matrix of means |
L |
p * p matrix specifying relations among the rows. By default, an identity matrix. |
R |
q * q matrix specifying relations among the columns. By default, an identity matrix. |
U |
LL^T - p * p positive definite variance-covariance matrix for rows, computed from L if not specified. |
V |
R^T R - q * q positive definite variance-covariance matrix for columns, computed from R if not specified. |
list |
Defaults to |
array |
If n = 1 and this is not specified and |
force |
If TRUE, will take the input of |
x |
quantile for density |
log |
logical; if TRUE, probabilities p are given as log(p). |
rmatrixnorm
returns either a list of
n p * q matrices or
a p * q * n array.
dmatrixnorm
returns the density at x
.
Gupta, Arjun K, and Daya K Nagar. 1999. Matrix Variate Distributions. Vol. 104. CRC Press. ISBN:978-1584880462
rmatrixt()
, rmatrixinvt()
,
rnorm()
and stats::Distributions()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | set.seed(20180202)
# a draw from a matrix variate normal with a certain mean
# and row-wise covariance
rmatrixnorm(
n = 1, mean = matrix(c(100, 0, -100, 0, 25, -1000), nrow = 2),
L = matrix(c(2, 1, 0, .1), nrow = 2), list = FALSE
)
set.seed(20180202)
# another way of specifying this - note the output is equivalent
A <- rmatrixnorm(
n = 10, mean = matrix(c(100, 0, -100, 0, 25, -1000), nrow = 2),
L = matrix(c(2, 1, 0, .1), nrow = 2), list = TRUE
)
A[[1]]
# demonstrating the dmatrixnorm function
dmatrixnorm(A[[1]],
mean = matrix(c(100, 0, -100, 0, 25, -1000), nrow = 2),
L = matrix(c(2, 1, 0, .1), nrow = 2), log = TRUE
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.