rstan (version 2.18.2)

plot-methods: Plots for stanfit objects

Description

The default plot shows posterior uncertainty intervals and point estimates for parameters and generated quantities. The plot method can also be used to call the other rstan plotting functions via the plotfun argument (see Examples).

Usage

# S4 method for stanfit,missing
plot(x, ..., plotfun)

Arguments

x

An instance of class '>stanfit.

plotfun

A character string naming the plotting function to apply to the stanfit object. If plotfun is missing, the default is to call stan_plot, which generates a plot of credible intervals and point estimates. See rstan-plotting-functions for the names and descriptions of the other plotting functions. plotfun can be either the full name of the plotting function (e.g. "stan_hist") or can be abbreviated to the part of the name following the underscore (e.g. "hist").

...

Optional arguments to plotfun.

Value

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

See Also

List of RStan plotting functions, Plot options

Examples

Run this code
# NOT RUN {
library(rstan)
fit <- stan_demo("eight_schools")
plot(fit)
plot(fit, show_density = TRUE, ci_level = 0.5, fill_color = "purple")
plot(fit, plotfun = "hist", pars = "theta", include = FALSE)
plot(fit, plotfun = "trace", pars = c("mu", "tau"), inc_warmup = TRUE)
plot(fit, plotfun = "rhat") + ggtitle("Example of adding title to plot")
# }

Run the code above in your browser using DataCamp Workspace