plot.hef {bang}R Documentation

Plot diagnostics for a hef object

Description

plot method for class "hef".

Usage

## S3 method for class 'hef'
plot(x, y, ..., 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)

Arguments

x

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

y

Not used.

...

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

params

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

  • "hyper": the posterior sample of all hyperparameter values in φ is plotted using plot.ru.

  • "ru": then only the posterior sample generated using ru is plotted using plot.ru. This produces a different plot to params = "hyper" if ru is used only on a subset of φ. 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 θ 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".

which_pop

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.

plot_type

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 θ for the populations in which_pop.

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

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

  • "pairs": pairwise scatter plots of the posterior samples of θ 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.

num

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.

Examples

See the examples in hef and hanova1.

See Also

plot.ru for arguments that may be passed via ...., in particular ru_scale.


[Package bang version 1.0.1 Index]