Learn R Programming

rstan (version 2.15.1)

traceplot: Markov chain traceplots

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.

Usage


  # S4 method for stanfit
traceplot(object, pars, include = TRUE, unconstrain = FALSE, 
          inc_warmup = FALSE, window = NULL, nrow = NULL, ncol = NULL, ...)

Arguments

object
An instance of class .
pars
A character vector of parameter names. Defaults to all parameters or the first 10 parameters (if there are more than 10).
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.
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.
unconstrain
Should parameters be plotted on the unconstrained space? Defaults to FALSE.
nrow,ncol
Passed to facet_wrap.
Optional arguments to pass to geom_path (e.g. size, linetype, alpha, etc.).

Value

A ggplot object that can be further customized using the ggplot2 package.

Methods

traceplot
signature(object = "stanfit")
Plot the sampling paths for all chains.

See Also

List of RStan plotting functions, Plot options

Examples

Run this code

Run the code above in your browser using DataLab