convergence: MCMC Convergence

Description Usage Arguments Value Note Examples

View source: R/convergence.R

Description

Monitor convergence of the MCMC algorithms.

Usage

1
convergence(object, param = NULL, type = "trace", print_names = FALSE)

Arguments

object

An object of class estimate or explore

param

Character string. Names of parameters for which to monitor MCMC convergence.

type

Character string. Which type of convergence plot ? The current options are trace (default) and acf.

print_names

Logical. Should the parameter names be printed (defaults to FALSE)? This can be used to first determine the parameter names to specify in type.

Value

A list of ggplot objects.

Note

An overview of MCMC diagnostics can be found here.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# note: iter = 250 for demonstrative purposes

# data
Y <- ptsd[,1:5]

#########################
###### continuous #######
#########################
fit <- estimate(Y, iter = 250,
                progress = FALSE)

# print names first
convergence(fit, print_names = TRUE)

# trace plots
convergence(fit, type = "trace",
            param = c("B1--B2", "B1--B3"))[[1]]

# acf plots
convergence(fit, type = "acf",
            param = c("B1--B2", "B1--B3"))[[1]]

BGGM documentation built on Dec. 3, 2020, 9:07 a.m.