| wishart | R Documentation |
Density and random generation for the wishart distribution
dwishart(x, nu, Sigma, log = FALSE)
rwishart(n, nu, Sigma)
x |
positive definite |
nu |
degrees of freedom, needs to be greater than |
Sigma |
scale matrix, needs to be positive definite and match the dimension of |
log |
logical; if |
n |
number of random deviates to return |
dwishart gives the density,
rwishart generates random deviates (matrix for n = 1, array with n slices for n > 1)
# single input: matrix-valued
x <- rwishart(1, nu = 5, Sigma = diag(3))
d <- dwishart(x, nu = 5, Sigma = diag(3))
# multiple inputs: array of matrices
x <- rwishart(4, nu = 5, Sigma = diag(3))
d <- dwishart(x, nu = 5, Sigma = diag(3))
# multiple inputs for x, nu and Sigma
nu <- c(7,5,8,9)
Sigma <- array(dim = c(3,3,4))
for(i in 1:4) Sigma[,,i] <- (i + 3) * diag(3)
x <- rwishart(4, nu, Sigma)
d <- dwishart(x, nu, Sigma)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.