rwishart | R Documentation |
Creates a random wishart distribution when given degrees of freedom and a sigma matrix.
rwishart(df, S)
df |
An |
S |
A |
A matrix
that is a Wishart distribution, aka the sample covariance
matrix of a Multivariate Normal Distribution
James Joseph Balamuta
riwishart()
and probitHLM()
# Call with the following data: rwishart(3, diag(2)) # Validation set.seed(1337) S = toeplitz((10:1)/10) n = 10000 o = array(dim = c(10,10,n)) for(i in 1:n){ o[,,i] = rwishart(20, S) } mR = apply(o, 1:2, mean) Va = 20*(S^2 + tcrossprod(diag(S))) vR = apply(o, 1:2, var) stopifnot(all.equal(vR, Va, tolerance = 1/16))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.