Skip to contents

Visualizes data from a BayesMassBal class object in a user specified way. Options include trace plots, posterior densities, and main effects plots. Meant to be a quick diagnostic tool, and not to produce publication quality plots.

Usage

# S3 method for BayesMassBal
plot(
  x,
  sample.params = NA,
  layout = c("trace", "dens"),
  hdi.params = c(1, 0.95),
  ssEst.ylab = "Mass",
  ...
)

Arguments

x

A BayesMassBal object returned from the BMB function

sample.params

List to be used for indicating model parameter samples used for creation of plot(s). See details for required structure.

layout

Character string indicating the desired data to be plotted. "trace" produces trace plots of sequential parameter draws. "dens" produces densities of posterior draws. Argument ignored when x$type = "time-series".

hdi.params

Numeric vector of length two, used to draw Highest Posterior Density Intervals (HPDI) using hdi, and otherwise ignored. hdi.params[1] = 1 indicates hdi bounds should be drawn. The second element of hdi is passed to credMass in the hdi function. The default, hdi.params = c(1,0.95), plots the 95% HPDI bounds.

ssEst.ylab

Character string providing the label for the y-axis of a time series plot when object type == "time-series". Argument only useful with the output from the ssEst function.

...

Passes extra arguments to plot()

Value

Plots BayesMassBal object based on arguments passed to plot.

Details

The list of sample.params requires a specific structure dependent on the choice of layout and the desired plots.

If layout = "trace" or layout = "dens", names(list) must contain each model parameter desired for plotting. The structure under the model parameter names must be the same as to the structure of the relevant subset of the BayesMassBal object to be used. For example, if a BayesMassBal object is created using a process with sample components c("CuFeS2","gangue") and the users wants plots of reconciled masses \(y_1\) and \(y_2\) for both components to be created, params = list(y.bal = list(CuFeS2 = c(1,2), gangue = c(1,2)) should be used. Note, str(params) mimics str(x), while the vectors listed simply index the desired model parameters to be plotted.

See vignette("Two_Node_Process", package = "BayesMassBal") for an example of the required structure.