View source: R/GGM_generator.R
ggm.generator | R Documentation |
Produce one or more samples from the specified Gaussian graphical model.
ggm.generator(n, Omega)
n |
The number of samples required. |
Omega |
The inverse covariance matrix of the specified Gaussian graphical model. |
A numeric matrix with n
rows and p
variables where p
corresponds to the dimension of Omega
.
Omega
should be positive definite.
library(gif)
set.seed(1)
n <- 200
p <- 100
Omega <- diag(1, p, p)
for(i in 1:(p - 1)) {
Omega[i, i + 1] <- 0.5
Omega[i + 1, i] <- 0.5
}
x <- ggm.generator(n, Omega)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.