if (FALSE) {
library( BDgraph )
set.seed( 10 )
# Generating multivariate normal data from a 'scale-free' graph
data.sim <- bdgraph.sim( n = 100, p = 10, graph = "scale-free", vis = TRUE )
# Running algorithm based on GGMs
bdgraph.obj <- bdgraph( data = data.sim, iter = 5000 )
summary( bdgraph.obj )
# To compare the result with true graph
compare( data.sim, bdgraph.obj, main = c( "Target", "BDgraph" ), vis = TRUE )
# Confusion Matrix
conf.mat( actual = data.sim, pred = bdgraph.obj )
conf.mat.plot( actual = data.sim, pred = bdgraph.obj )
# Running algorithm based on GGMs and marginal pseudo-likelihood
bdgraph.mpl.obj <- bdgraph.mpl( data = data.sim, iter = 5000 )
summary( bdgraph.mpl.obj )
# Confusion Matrix
conf.mat( actual = data.sim, pred = bdgraph.mpl.obj )
conf.mat.plot( actual = data.sim, pred = bdgraph.mpl.obj )
# To compare the results of both algorithms with true graph
compare( data.sim, list( bdgraph.obj, bdgraph.mpl.obj ),
main = c( "Target", "BDgraph", "BDgraph_mpl" ), vis = TRUE )
}
Run the code above in your browser using DataLab