require(mvtnorm)
nVar <- 50 ## number of variables
maxCon <- 5 ## maximum connectivity per variable
nObs <- 30 ## number of observations to simulate
A <- qpRndGraph(p=nVar, d=maxCon)
Sigma <- qpG2Sigma(A, rho=0.5)
X <- rmvnorm(nObs, sigma=as.matrix(Sigma))
nrr.estimates <- qpNrr(X, q=5, verbose=FALSE)
qpHist(nrr.estimates, A)
Run the code above in your browser using DataLab