| ggm.simulate.data {GeneTS} | R Documentation |
ggm.simulate.data takes a positive definite partial correlation matrix and
generates an iid sample from the corresponding standard multinormal distribution
(with mean 0 and variance 1).
ggm.simulate.data(sample.size, pcor)
sample.size |
sample size of simulated data set |
pcor |
partial correlation matrix |
A multinormal data matrix.
Juliane Schaefer (http://www.stat.uni-muenchen.de/~schaefer/) and Korbinian Strimmer (http://www.stat.uni-muenchen.de/~strimmer/).
Schaefer, J., and Strimmer, K. (2005). An empirical Bayes approach to inferring large-scale gene association networks. Bioinformatics 21:754-764.
ggm.simulate.pcor, ggm.estimate.pcor.
# load GeneTS library
library(GeneTS)
# generate random network with 40 nodes
# it contains 780=40*39/2 edges of which 5 percent (=39) are non-zero
true.pcor <- ggm.simulate.pcor(40)
# simulate data set with 40 observations
m.sim <- ggm.simulate.data(40, true.pcor)
# simple estimate of partial correlations
estimated.pcor <- partial.cor(m.sim)
# comparison of estimated and true model
sum((true.pcor-estimated.pcor)^2)
# a slightly better estimate ...
estimated.pcor.2 <- ggm.estimate.pcor(m.sim, method = c("bagged.pcor"))
sum((true.pcor-estimated.pcor.2)^2)