draw_U | R Documentation |
Simulates from a multivariate normal distribution and returns a matrix with appropriate dimensions.
draw_U(Psi_chol, n_y)
Psi_chol |
Cholesky decomposition of the covariance matrix. |
n_y |
number of markers. |
library(SimSurvNMarker) set.seed(1) n_y <- 2L K <- 3L * n_y Psi <- drop(rWishart(1, K, diag(K))) Psi_chol <- chol(Psi) # example dim(draw_U(Psi_chol, n_y)) samples <- replicate(100, draw_U(Psi_chol, n_y)) samples <- t(apply(samples, 3, c)) colMeans(samples) # ~ zeroes cov(samples) # ~ Psi
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.