convergence.plot {FlexReg}R Documentation

Convergence plots

Description

The function produces some convergence plots from the Monte Carlo draws.

Usage

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
)

Arguments

model

an object of class `flexreg`.

file

a character string giving the name of the file (including the extension .pdf) containing the convergence plots. If NULL, the convergence plots are printed in the graphics window.

plotfun

an optional character vector of diagnostics plots. The default is to compute "all" plots, otherwise one can specify a subset of plots among "density", "trace", "intervals", "rate", "rhat", and "acf".

pars

an optional character vector of parameter names. If pars is not specified, all parameters in the regression models are evaluated.

point_est

an optional character to specify the point estimate to be shown between "median" (the default), "mean", or "none".

prob

the probability mass to be included in the inner interval (for "intervals" plot) or in the shaded region (for "density" plot). The default is 0.5.

prob_outer

the probability mass to be included in the outer interval of the "intervals" plot. The default is 0.9.

lags

the number of lags to be shown in the "acf" plot. The default is 10.

warmup

a logical scalar indicating whether to include the warmup draws or not (default).

width, height

the width and height of the graphics region of each plot in inches. The default values are 7.

Details

Moreover, the convergence plots can be further customized using the ggplot2 package.

Value

A .pdf file with one plot per page.

References

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

Examples

## Not run: 
data("Reading")
FB <- flexreg(accuracy.adj ~ iq, data = Reading, type = "FB")
convergence.plot(FB, file = "Convergence_plot_Output.pdf", pars = "beta")

## End(Not run)


[Package FlexReg version 1.3.0 Index]