posterior_samples: Extract Posterior Samples

Description Usage Arguments Value Examples

View source: R/posterior_samples.R

Description

Extract posterior samples for all parameters.

Usage

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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])

BGGM documentation built on Aug. 20, 2021, 5:08 p.m.