posterior_samples {BGGM}R Documentation

Extract Posterior Samples

Description

Extract posterior samples for all parameters.

Usage

posterior_samples(object, ...)

Arguments

object

an object of class estimate or explore.

...

currently ignored.

Value

A matrix of posterior samples for the partial correlation. Note that if controlling for variables (e.g., formula ~ age), the matrix also includes the coefficients from each multivariate regression.

Examples


# note: iter = 250 for demonstrative purposes

########################################
### example 1: control  with formula ###
########################################
# (the following works with all data types)

# controlling for gender
Y <- bfi

# to control for only gender
# (remove education)
Y <- subset(Y, select = - education)

# fit model
fit <- estimate(Y, formula = ~ gender,
                iter = 250)

# note regression coefficients
samps <- posterior_samples(fit)

hist(samps[,1])



[Package BGGM version 2.1.1 Index]