require(mvtnorm)
nVar <- 50 ## number of variables
maxCon <- 5 ## maximum connectivity per variable
nObs <- 30 ## number of observations to simulate
set.seed(123)
A <- qpRndGraph(p=nVar, d=maxCon)
Sigma <- qpG2Sigma(A, rho=0.5)
X <- rmvnorm(nObs, sigma=as.matrix(Sigma))
## the higher the q the less complex the qp-graph
nrr.estimates <- qpNrr(X, q=1, verbose=FALSE)
qpClique(nrr.estimates, plot=FALSE)$complexity
nrr.estimates <- qpNrr(X, q=5, verbose=FALSE)
qpClique(nrr.estimates, plot=FALSE)$complexity
Run the code above in your browser using DataLab