The function produces a .pdf file containing some convergence plots for the Monte Carlo draws.
convergence.plot(
model,
file = "convergence-output.pdf",
plotfun = "all",
pars = NULL,
point_est = "median",
prob = 0.5,
prob_outer = 0.9,
lags = 10,
warmup = F,
width = 7,
height = 7
)A .pdf file with one plot per page.
an object of class `flexreg`.
a character string giving the name of the file (with extension .pdf).
an optional character vector of diagnostics plots. The default is to compute all plots, otherwise one can specify a selection of plots among density, trace, intervals, rate, rhat, and acf.
an optional character vector of parameter names. If pars is not specified, all parameters in the regression models are evaluated.
an optional character to specify the point estimate to be shown between median (the default), mean, or none.
the probability mass to be included in the inner interval (intervals plot) or in the shaded region (for density plot). The default is 0.5.
the probability mass to be included in the outer interval of the intervals plot. The default is 0.9.
the number of lags to be shown in the acf plot. The default is 10.
a logical scalar indicating whether to include the warmup draws or not (default).
the width and height of the graphics region of each plot in inches. The default values are 7.
The plots can be further customized using the ggplot2 package.
density returns a density plot for each parameter in pars computed from the posterior draws. See bayesplot::mcmc_areas for further details.
trace returns a trace plot for each parameter in pars computed from the posterior draws. See bayesplot::mcmc_trace for further details.
intervals returns a plot of uncertainty interval for each parameter in pars computed from the posterior draws. See bayesplot::mcmc_intervals for further details.
rate returns a plot for each parameter in pars with the number of iterations on the x-axis and the Monte Carlo mean until iteration i-th on the y-axis.
rhat returns a plot with the Rhat values for each parameter in pars. See bayesplot::mcmc_rhat for further details.
acf returns the autocorrelation plots (one for each parameter in pars). See bayesplot::mcmc_acf for further details.
Brooks, SP., Gelman, A. (1998). General methods for monitoring convergence of iterative simulations. Journal of Computational and Graphical Statistics, 7, 434-455.
Stan Development Team (2020). RStan: the R interface to Stan. R package version 2.19.3. https://mc-stan.org