| ggm_search | R Documentation |
The 'ggm_search' function performs a Metropolis-Hastings graph search to identify high-probability graph structures. At each iteration, one edge is randomly proposed to flip (add or remove, chosen by an independent coin flip), and the proposal is accepted or rejected using a proper MH acceptance ratio (including a birth-death Hastings correction for the proposal-size asymmetry between the add and remove moves), so the walk can move to a worse-BIC graph and is not just a hill-climb. It also computes an optional Bayesian Model Averaged (BMA) solution: the distinct graphs visited after burn-in are reweighted by their BIC-approximated posterior model probabilities.
ggm_search(
x,
n = NULL,
method = "mc3",
prior_prob = 0.3,
iter = 5000,
burn_in = NULL,
stop_early = 1000,
bma_mean = TRUE,
seed = NULL,
progress = TRUE,
probabilistic = TRUE,
...
)
x |
Data, either raw data or covariance matrix |
n |
For x = covariance matrix, provide number of observations |
method |
mc3 defaults to MH sampling |
prior_prob |
Prior prbability of sparseness. |
iter |
Number of iterations |
burn_in |
Number of initial iterations discarded before computing
the BMA solution. Defaults to |
stop_early |
Default to 1000. Only used when |
bma_mean |
Compute Bayesian Model Averaged solution |
seed |
Set seed. Current default is to set R's random seed. |
progress |
Show progress bar, defaults to TRUE |
probabilistic |
Defaults to TRUE: a genuine Metropolis-Hastings sampler over graph structures (see Details). Set to FALSE for the deterministic greedy hill-climb instead. |
... |
Not currently in use |
Set probabilistic = FALSE to instead run a deterministic greedy
hill-climb (accept a proposed edge flip only if it improves BIC). This
is much faster per iteration but explores far less of graph space in
practice — in testing it can get stuck after accepting only a handful
of moves, well before iter is reached, and stop_early
exists to end the search once that happens.
This function is ideal for exploring the graph space and obtaining an initial estimate of the graph structure or adjacency matrix.
To refine the results or compute posterior distributions of graph parameters
(e.g., partial correlations), use the bma_posterior function,
which builds on the output of 'ggm_search' to account for parameter uncertainty.
A list containing the MAP graph structure, BMA solution (if specified), and BIC-approximated posterior probabilities of the graphs visited during the search.
Donny Williams and Philippe Rast
bma_posterior
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.