# generate the data from multivariate normal distribution
data.sim <- bdgraph.sim(n = 100, p = 8, size = 9, vis = T)
# selecting the best graph according to BD-MCMC algorithm
output <- bdgraph(data.sim, meanzero = T, iter = 5000)
compare(data.sim, output, colnames = c("true graph", "BDgraph"))
# selecting the best graph by huge package
huge.g <- huge(data.sim $ data, method = "mb")
huge.g <- huge.select(huge.g)
# comparing the result by using "compare" function
compare(data.sim, output, estimate2 = huge.g $ refit, colnames = c("true graph", "BDgraph", "huge"))
Run the code above in your browser using DataLab