SLIDE 18 Simulation of Homogeneous Mixed GMMs
rHMgmm() simulates homogeneous mixed GMMs taking as input either a
markedGraphParam or graphBAM object. It returns an S4 object of class
- HMgmm. Here we simulate one involving 250 joint discrete levels:
> set.seed(12345) > gmm <- rHMgmm(n=1, dRegularMarkedGraphParam(pI=50, pY=100, d=2), a=2) > names(gmm) [1] "X" "I" "Y" "p" "pI" "pY" "g" "mean" "sigma" [10] "a" "eta2" > print(object.size(gmm), units="Kb") 90.1 Kb
rcmvnorm() simulates data from a homogeneous mixed GMM using rmvnorm()
for the continuous observations (mvtnorm package):
> set.seed(123) > X <- rcmvnorm(n=1000, gmm) > Ymix <- gmm$Y[which(rowSums(as(gmm$g, "matrix")[gmm$Y, gmm$I]) == 1)] > Imix <- gmm$I[apply(as(gmm$g, "matrix")[Ymix, gmm$I] == 1, 1, which)] > smean <- sapply(1:length(Ymix), function(i, Y, I) tapply(Y[, i], I[, i], mean), + X[, Ymix], X[, Imix]) > mean(abs(smean[1, ] - smean[2, ])) ## sample additive effects approach the given one [1] 2.028512
Inma Tur, Alberto Roverato, Robert Castelo Simulation of molecular regulatory networks with graphical models 18 / 27