bayesplot packagePlots of Rhat statistics, ratios of effective sample size to total sample size, and autocorrelation of MCMC draws.
mcmc_intervals(object, ...)# S4 method for bayesGAMfit
mcmc_intervals(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_areas(object, ...)
# S4 method for bayesGAMfit
mcmc_areas(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_hist(object, ...)
# S4 method for bayesGAMfit
mcmc_hist(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_hist_by_chain(object, ...)
# S4 method for bayesGAMfit
mcmc_hist_by_chain(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_dens(object, ...)
# S4 method for bayesGAMfit
mcmc_dens(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_scatter(object, ...)
# S4 method for bayesGAMfit
mcmc_scatter(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_hex(object, ...)
# S4 method for bayesGAMfit
mcmc_hex(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_pairs(object, ...)
# S4 method for bayesGAMfit
mcmc_pairs(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_acf(object, ...)
# S4 method for bayesGAMfit
mcmc_acf(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_acf_bar(object, ...)
# S4 method for bayesGAMfit
mcmc_acf_bar(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_trace(object, ...)
# S4 method for bayesGAMfit
mcmc_trace(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_rhat(object, ...)
# S4 method for bayesGAMfit
mcmc_rhat(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_rhat_hist(object, ...)
# S4 method for bayesGAMfit
mcmc_rhat_hist(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_rhat_data(object, ...)
# S4 method for bayesGAMfit
mcmc_rhat_data(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_neff(object, ...)
# S4 method for bayesGAMfit
mcmc_neff(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_neff_hist(object, ...)
# S4 method for bayesGAMfit
mcmc_neff_hist(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_neff_data(object, ...)
# S4 method for bayesGAMfit
mcmc_neff_data(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
mcmc_violin(object, ...)
# S4 method for bayesGAMfit
mcmc_violin(
object,
regex_pars = c("^beta", "^lambda", "^eps", "^a", "^sigma_u_correlation"),
...
)
an object of class bayesGAMfit
optional additional arguments to pass to the bayesplot functions
character vector of regular expressions of variable names to plot
These functions call various plotting functions from the bayesplot package, which returns a list including ggplot2 objects.
mcmc_hist(object, ...)
Default plot called by plot function. Histograms of posterior draws with all chains merged.
mcmc_dens(object, ...)
Kernel density plots of posterior draws with all chains merged.
mcmc_hist_by_chain(object, ...)
Histograms of posterior draws with chains separated via faceting.
mcmc_dens_overlay(object, ...)
Kernel density plots of posterior draws with chains separated but
overlaid on a single plot.
mcmc_violin(object, ...)
The density estimate of each chain is plotted as a violin with
horizontal lines at notable quantiles.
mcmc_dens_chains(object, ...)
Ridgeline kernel density plots of posterior draws with chains separated
but overlaid on a single plot. In mcmc_dens_overlay() parameters
appear in separate facets; in mcmc_dens_chains() they appear in the
same panel and can overlap vertically.
mcmc_intervals(object, ...)
Plots of uncertainty intervals computed from posterior draws with all
chains merged.
mcmc_areas(object, ...)
Density plots computed from posterior draws with all chains merged,
with uncertainty intervals shown as shaded areas under the curves.
mcmc_scatter(object, ...)
Bivariate scatterplot of posterior draws. If using a very large number of
posterior draws then mcmc_hex() may be preferable to avoid
overplotting.
mcmc_hex(object, ...)
Hexagonal heatmap of 2-D bin counts. This plot is useful in cases where
the posterior sample size is large enough that mcmc_scatter() suffers
from overplotting.
mcmc_pairs(object, ...)
A square plot matrix with univariate marginal distributions along the
diagonal (as histograms or kernel density plots) and bivariate
distributions off the diagonal (as scatterplots or hex heatmaps).
For the off-diagonal plots, the default is to split the chains so that
(roughly) half are displayed above the diagonal and half are below (all
chains are always merged together for the plots along the diagonal). Other
possibilities are available by setting the condition argument.
mcmc_rhat(object, ...), mcmc_rhat_hist(object, ...)
Rhat values as either points or a histogram. Values are colored using
different shades (lighter is better). The chosen thresholds are somewhat
arbitrary, but can be useful guidelines in practice.
light: below 1.05 (good)
mid: between 1.05 and 1.1 (ok)
dark: above 1.1 (too high)
mcmc_neff(object, ...), mcmc_neff_hist(object, ...)
Ratios of effective sample size to total sample size as either points or a
histogram. Values are colored using different shades (lighter is better).
The chosen thresholds are somewhat arbitrary, but can be useful guidelines
in practice.
light: between 0.5 and 1 (high)
mid: between 0.1 and 0.5 (good)
dark: below 0.1 (low)mcmc_acf(object, ...), mcmc_acf_bar(object, ...)
Grid of autocorrelation plots by chain and parameter. The lags argument
gives the maximum number of lags at which to calculate the autocorrelation
function. mcmc_acf() is a line plot whereas mcmc_acf_bar() is a
barplot.
Gabry, Jonah and Mahr, Tristan (2019). bayesplot: Plotting for Bayesian Models. https://mc-stan.org/bayesplot/
Gabry, J., Simpson, D., Vehtari, A., Betancourt, M., and Gelman, A (2019). Visualization in Bayesian Workflow. Journal of the Royal Statistical Society: Series A. Vol 182. Issue 2. p.389-402.
Gelman, A. and Rubin, D. (1992) Inference from Iterative Simulation Using Multiple Sequences. Statistical Science 7(4) 457-472.
Gelman, A., et. al. (2013) Bayesian Data Analysis. Chapman and Hall/CRC.
# NOT RUN {
f <- bayesGAM(weight ~ np(height), data = women,
family = gaussian, iter=1000, chains = 1)
mcmc_trace(f)
# }
Run the code above in your browser using DataLab