Learn R Programming

BGGM (version 2.0.3)

bma_posterior: Bayesian Model Averaged Posterior Distribution

Description

Draw samples from the posterior distribution according to the most probable graphs (weighted by their respective posterior model probabilities)

Usage

bma_posterior(object, param = "pcor", iter = 5000, progress = TRUE)

Arguments

object

An object of class ggm_search

param

Character string. What parameter should be computed ? The default is param = "pcor" which provides the partial correlations. The other option is the precision matrix (i.e., precision).

iter

Number of iterations (posterior samples; defaults to 5000).

progress

Logical. Should a progress bar be included (defaults to TRUE) ?

Value

  • bma_mean The mean of the partial correlation or precision matrix (p by p matrix).

  • samples 3d array of dimensions p by p by iter including the samples partial correlation or precision matrices.

Details

This approach is based on the "direct sampler" described in @page 122, section 2.4, @lenkoski2013direct;textualBGGM. In this case, the posterior is sampled according to the posterior probabilities for the top ranking graphs.

References

Examples

Run this code
# NOT RUN {
# data
Y <- ptsd

# fit model
fit <- ggm_search(Y)

# bma
bma <- bma_posterior(fit, iter = 100)

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab