traceplot_Rsero: Markov chain Traceplot

View source: R/traceplot_Rsero.R

traceplot_RseroR Documentation

Markov chain Traceplot

Description

Draw the traceplot corresponding to one or more Markov chains, providing a visual way to inspect sampling behavior and assess mixing across chains and convergence. It is an adaptation of the function traceplot in the rstan package.

Usage

traceplot_Rsero(
  FOIfit,
  pars = NULL,
  include = TRUE,
  unconstrain = FALSE,
  inc_warmup = FALSE,
  window = NULL,
  nrow = NULL,
  ncol = NULL,
  ...
)

Arguments

FOIfit

A FOIfit object.

pars

A character vector of parameter names. Defaults to relevant parameters of the model.

include

Should the parameters given by the pars argument be included (the default) or excluded from the plot? Only relevant if pars is not missing.

unconstrain

Should parameters be plotted on the unconstrained space? Defaults to FALSE.

inc_warmup

TRUE or FALSE, indicating whether the warmup sample are included in the trace plot; defaults to FALSE.

window

A vector of length 2. Iterations between window[1] and window[2] will be shown in the plot. The default is to show all iterations if inc_warmup is TRUE and all iterations from the sampling period only if inc_warmup is FALSE. If inc_warmup is FALSE the iterations specified in window should not include iterations from the warmup period.

nrow,

ncol Passed to facet_wrap.

...

Optional arguments to pass to geom_path (e.g. size, linetype, alpha, etc.).

object

An instance of class stanfit.

Author(s)

Nathanael Hoze nathanael.hoze@gmail.com

Examples

##'   data <- simulate_SeroData(number_samples = 1000,
  age_class = 1,
  epidemic_years = c(1976,1992),
  foi = c(0.2,0.3))
model <- FOImodel('outbreak', K = 2)
F1 <- fit(model = model, data = data)
traceplot_Rsero(F1)


nathoze/Rsero documentation built on Feb. 3, 2024, 9:58 p.m.