brms (version 0.10.0)

stanplot.brmsfit: Various Plotting Functions implemented in rstan

Description

Conveniant way to call plotting functions implemented in the rstan package.

Usage

"stanplot"(object, pars = NA, type = "plot", exact_match = FALSE, quiet = FALSE, ...)
stanplot(object, pars, ...)

Arguments

object
An R object typically of class brmsfit
pars
Names of parameters to be plotted, as given by a character vector or regular expressions. By default, the first 10 parameters are plotted.
type
The type of the plot. Supported types are (as names) plot, trace, hist, dens, scat, diag, rhat, ess, mcse, ac. For an overview on the various plot types see plotting-functions.
exact_match
Indicates whether parameter names should be matched exactly or treated as regular expression. Default is FALSE.
quiet
A flag indicating whether messages produced by ggplot2 during the plotting process should be silenced. Default is FALSE.
...
Additional arguments passed to the plotting functions.

Value

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

Details

Instead of using stanplot(), the plotting functions can be called directly via stan_($fit). For more details on the plotting functions see Plots as well as Diagnostic plots. Note that the plotting functions themselves only accept full parameter names, while stanplot allows for partial matching and regular expressions. You should also consider using the shinystan package available via method launch_shiny in brms for flexible and interactive visual analysis.

Examples

Run this code
## Not run: 
# model <- brm(count ~ log_Age_c + log_Base4_c * Trt_c 
#              + (1|patient) + (1|visit),
#              data = epilepsy, family = "poisson")
# # plot 95% CIs
# stanplot(model, type = "plot", ci_level = 0.95)
# # equivalent to
# stan_plot(model$fit, ci_level = 0.95)
# 
# # only show fixed effects in the plots
# # this will not work when calling stan_plot directly
# stanplot(model, pars = "^b", type = "plot", ci_level = 0.95)
# 
# # plot some diagnostics on the sampler
# stanplot(model, type = "diag")
# # equivalent to 
# stan_diag(model$fit)                           
# ## End(Not run)

Run the code above in your browser using DataLab