R package ssgraph is designed for Bayesian structure learning in graphical models using spike-and-slab priors.
To speed up the computations, the computationally intensive tasks of the package are implemented in
C++ in parallel using OpenMP.
You can install the latest version from CRAN using:
install.packages( "ssgraph" )
require( "ssgraph" )
This is a simple example to see the preformance of the
Frist, by using the function
bdgraph.sim we simulate 60 observations (n = 60) from a multivariate
Gaussian distribution with 8 variables (p = 8) and “scale-free” graph structure, as follows:
data.sim = bdgraph.sim( n = 100, p = 8, graph = "scale-free", vis = TRUE ) round( head( data.sim $ data, 4 ), 2 )
Since the generated data are Gaussian, we run
ssgraph function by choosing
method = "ggm", as follows:
ssgraph.obj <- ssgraph( data = data.sim, method = "ggm", iter = 5000, save = TRUE ) summary( ssgraph.obj )
To compare the result with true graph
compare( data.sim, ssgraph.obj, main = c( "Target", "ssgraph" ), vis = TRUE )
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.