plot.hef {bang}R Documentation

Plot diagnostics for a hef object


plot method for class "hef".


## S3 method for class 'hef'
  params = c("hyper", "ru", "pop"),
  which_pop = NULL,
  plot_type = NULL,
  one_plot = FALSE,
  add_legend = FALSE,
  legend_position = "topright",
  legend_text = NULL,
  num = 100



an object of class "hef", a result of a call to ru.


Not used.


Additional arguments passed to, hist or pairs. In particular, ru_scale = TRUE produces a plot using the parameterization used for ratio-of-uniforms sampling.


A character scalar that determines to which parameters the plots relate.

  • "hyper": the posterior sample of all hyperparameter values in \phi is plotted using

  • "ru": only the posterior sample generated using ru is plotted using This produces a different plot to params = "hyper" if ru is used only on a subset of \phi. For example, this may be the case if x is the result of a call to hanova1. See vignette("bang-c-anova-vignette", package = "bang") for information.

  • "pop": posterior samples and/or densities of the population-specific parameter \theta are plotted. The population(s) included are determined by which_pop and the type of plot is determined by plot_type. If plot_type is not supplied then it is set to "dens".


An integer vector or character scalar. If params = "pop" then which_pop indicates which populations to include in the plot. If which_pop is supplied then params is set to "pop". If which_pop = "all" then all populations are included. If there are many populations then this may fail if plot_type = "pairs" and/or one_plot = FALSE.


A character scalar that determines the type of plot produced when params = "pop". If plot_type is supplied then params is set automatically to "pop".

  • "sim": histograms of the posterior samples of \theta for the populations in which_pop.

  • "dens": estimates of the marginal posterior densities of \theta for the populations in which_pop.

  • "both": both the histograms and estimated posterior densities.

  • "pairs": pairwise scatter plots of the posterior samples of \theta for the populations in which_pop, which must have length greater than one.

one_plot, add_legend, legend_position, legend_text

Only relevant if plot_type = "dens". If one_plot = TRUE then the estimated marginal posterior densities are plotted in the same graph and if add_legend = TRUE then a legend is added to this plot using legend in the position indicated by the character scalar legend_position. A character vector legend_text may be used to override the default legend text.


A numeric scalar. If plot_type == "dens" or plot_type == "both" then num gives the number of points at which the marginal densities are evaluated to produce plots.


See the examples in hef and hanova1.

See Also for arguments that may be passed via ...., in particular ru_scale.

[Package bang version 1.0.3 Index]