View source: R/convergence.plot.R
convergence.plot | R Documentation |
The function produces some convergence plots from 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
)
model |
an object of class |
file |
a character string giving the name of the file (including the extension .pdf) containing the convergence plots. If |
plotfun |
an optional character vector of diagnostics plots. The default is to compute |
pars |
an optional character vector of parameter names. If |
point_est |
an optional character to specify the point estimate to be shown between |
prob |
the probability mass to be included in the inner interval (for |
prob_outer |
the probability mass to be included in the outer interval of the |
lags |
the number of lags to be shown in the |
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. |
"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.
Moreover, the convergence plots can be further customized using the ggplot2 package.
A .pdf file with one plot per page.
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
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.