View source: R/stan_caterpillar.R
| stan_caterpillar | R Documentation | 
Create caterpillar plots from rstan's stanfit objects
stan_caterpillar( obj, pars, pars_labels = NULL, hpd = TRUE, order_medians = TRUE, horizontal = TRUE, alpha_bounds = 0.3 )
obj | 
 a   | 
pars | 
 scalar or vector regular expressions for parameter
labels that you would like to plot as declared in   | 
pars_labels | 
 vector of parameter labels for the output plot. Important:
they must be in the same order as in the   | 
hpd | 
 logical. If   | 
order_medians | 
 logical. Whether or not to order the points by their medians.  | 
horizontal | 
 logical. Whether or not you would like the lines to be horizontal  | 
alpha_bounds | 
 numeric. Alpha transparency value for the uncertainty bounds.  | 
Points plot the simulations' medians, thin lines represent the 95 HPD/central intervals, and thick lines represent the 90 intervals.
rstan, stan, ggmcmc
## Not run: 
# Create Stan model
library(rstan)
scode <- "
   parameters {
       real y[2];
   }
   model {
       y[1] ~ normal(0, 1);
       y[2] ~ double_exponential(0, 2);
   }
"
# Run
fit <- stan(model_code = scode, iter = 10000, verbose = FALSE)
# Plot y[1] and y[2] parameters
stan_caterpillar(fit, pars = 'y\\[.*\\]')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.