Learn R Programming

ggmcmc (version 1.5.1.1)

ggs_caterpillar: Caterpillar plot with thick and thin CI

Description

Caterpillar plots are plotted combining all chains for each parameter.

Usage

ggs_caterpillar(
  D,
  family = NA,
  X = NA,
  thick_ci = c(0.05, 0.95),
  thin_ci = c(0.025, 0.975),
  line = NA,
  horizontal = TRUE,
  model_labels = NULL,
  label = NULL,
  comparison = NULL,
  comparison_separation = 0.2,
  greek = FALSE,
  sort = TRUE
)

Arguments

D

Data frame whith the simulations or list of data frame with simulations. If a list of data frames with simulations is passed, the names of the models are the names of the objects in the list.

family

Name of the family of parameters to plot, as given by a character vector or a regular expression. A family of parameters is considered to be any group of parameters with the same name but different numerical value between square brackets (as beta[1], beta[2], etc).

X

data frame with two columns, Parameter and the value for the x location. Parameter must be a character vector with the same names that the parameters in the D object.

thick_ci

Vector of length 2 with the quantiles of the thick band for the credible interval

thin_ci

Vector of length 2 with the quantiles of the thin band for the credible interval

line

Numerical value indicating a concrete position, usually used to mark where zero is. By default do not plot any line.

horizontal

Logical. When TRUE (the default), the plot has horizontal lines. When FALSE, the plot is reversed to show vertical lines. Horizontal lines are more appropriate for categorical caterpillar plots, because the x-axis is the only dimension that matters. But for caterpillar plots against another variable, the vertical position is more appropriate.

model_labels

Vector of strings that matches the number of models in the list. It is only used in case of multiple models and when the list of ggs objects given at D is not named. Otherwise, the names in the list are used.

label

Character value with the name of the variable that contains the labels displayed in the plot. Defaults to NULL, which corresponds to using the Parameter name or the Label in case par_labels is used in the ggs() object.

comparison

Character value with the name of the variable that contains the focus of the comparison. Defaults to NULL, which corresponds to no comparison. It is not expected to be used together with X.

comparison_separation

Numerical value with the separation between the dodged parameters. Defaults to 0.2.

greek

Logical value indicating whether parameter labels have to be parsed to get Greek letters. Defaults to false.

sort

Logical value indicating whether, in a horizontal display, y-axis labels must be sorted (the default) or not.

Value

A ggplot object.

References

Fern<U+00E1>ndez-i-Mar<U+00ED>n, Xavier (2016) ggmcmc: Analysis of MCMC Samples and Bayesian Inference. Journal of Statistical Software, 70(9), 1-20. doi:10.18637/jss.v070.i09

Examples

Run this code
# NOT RUN {
data(linear)
ggs_caterpillar(ggs(s))
ggs_caterpillar(list(A=ggs(s), B=ggs(s))) # silly example duplicating the same model
# }

Run the code above in your browser using DataLab