constrained_posterior {BGGM} | R Documentation |
Constrained Posterior Distribution
Description
Compute the posterior distribution with off-diagonal elements of the precision matrix constrained to zero.
Usage
constrained_posterior(
object,
adj,
method = "direct",
iter = 5000,
progress = TRUE,
...
)
Arguments
object |
An object of class |
adj |
A |
method |
Character string. Which method should be used ? Defaults to
the "direct sampler" (i.e., |
iter |
Number of iterations (posterior samples; defaults to 5000). |
progress |
Logical. Should a progress bar be included (defaults to |
... |
Currently ignored. |
Value
An object of class contrained
, including
-
precision_mean
The posterior mean for the precision matrix. -
pcor_mean
The posterior mean for the precision matrix. -
precision_samps
A 3d array of dimensionp
byp
byiter
including the sampled precision matrices. -
pcor_samps
A 3d array of dimensionp
byp
byiter
including sampled partial correlations matrices.
References
Lenkoski A (2013). “A direct sampler for G-Wishart variates.” Stat, 2(1), 119–128.
Examples
# data
Y <- bfi[,1:10]
# sample posterior
fit <- estimate(Y, iter = 100)
# select graph
sel <- select(fit)
# constrained posterior
post <- constrained_posterior(object = fit,
adj = sel$adj,
iter = 100,
progress = FALSE)