combinePlotsBSL {BSL}R Documentation

Plot the densities of multiple “bsl” class objects.

Description

The function combinePlotsBSL can be used to plot multiple BSL densities together, optionally with the true values for the parameters.

Usage

combinePlotsBSL(
  objectList,
  which = 1L,
  thin = 1,
  burnin = 0,
  thetaTrue = NULL,
  label = NULL,
  legendPosition = c("auto", "right", "bottom")[1],
  legendNcol = NULL,
  col = NULL,
  lty = NULL,
  lwd = NULL,
  cex.lab = 1,
  cex.axis = 1,
  cex.legend = 0.75,
  top = "Approximate Marginal Posteriors",
  options.color = list(),
  options.linetype = list(),
  options.size = list(),
  options.theme = list()
)

Arguments

objectList

A list of “bsl” class objects.

which

An integer argument indicating which plot function to be used. The default, 1L, uses the plain plot to visualise the result. 2L uses ggplot2 to draw the plot.

thin

A numeric argument indicating the gap between samples to be taken when thinning the MCMC draws. The default is 1, which means no thinning is used.

burnin

the number of MCMC burn-in steps to be taken.

thetaTrue

A set of true parameter values to be included on the plots as a reference line. The default is NULL.

label

A string vector indicating the labels to be shown in the plot legend. The default is NULL, which uses the names from objectList.

legendPosition

One of the three string arguments, “auto”, “right” or “bottom”, indicating the legend position. The default is “auto”, which automatically choose from “right” and “bottom”. Only used when which is 1L.

legendNcol

An integer argument indicating the number of columns of the legend. The default, NULL, put all legends in the same row or column depending on legendPosition. Only used when which is 1L.

col

A vector argument containing the plotting color for each density curve. Each element of the vector will be passed into lines. Only used when which is 1L.

lty

A vector argument containing the line type for each density curve. Each element of the vector will be passed into lines. Only used when which is 1L.

lwd

A vector argument containing the line width for each density curve. Each element of the vector will be passed into lines. Only used when which is 1L.

cex.lab

The magnification to be used for x and y labels relative to the current setting of cex. To be passed into plot. Only used when which is 1L.

cex.axis

The magnification to be used for axis annotation relative to the current setting of cex. To be passed into plot. Only used when which is 1L.

cex.legend

The magnification to be used for legend annotation relative to the current setting of cex. Only used when which is 1L.

top

A string argument of the combined plot title. Only used when which is 2L.

options.color

A list of additional arguments to pass into function ggplot2::scale_color_manual. Only used when which is 2L.

options.linetype

A list of additional arguments to pass into function ggplot2::scale_linetype_manual. Only used when which is 2L.

options.size

A list of additional arguments to pass into function ggplot2::scale_size_manual. Only used when which is 2L.

options.theme

A list of additional arguments to pass into the theme function. Only use when which is 2L.

Value

No return value, called for the plots produced.

See Also

ma2, cell, mgnk and toad for examples.

Examples


## Not run: 
toy_sim <- function(n, theta) matrix(rnorm(2*n, theta), nrow = n)
toy_sum <- ma2_sum

model <- newModel(fnSimVec = toy_sim, fnSum = toy_sum, sumArgs = list(epsilon = 2), theta0 = 0)

result1 <- bsl(y = 1:2, n = 100, M = 5e3, model = model, covRandWalk = matrix(1),
               method = "BSL", plotOnTheFly = TRUE)
result2 <- bsl(y = 1:2, n = 100, M = 5e3, model = model, covRandWalk = matrix(1),
               method = "uBSL", plotOnTheFly = TRUE)
result3 <- bsl(y = 1:2, n = 100, M = 5e3, model = model, covRandWalk = matrix(1),
               method = "semiBSL", plotOnTheFly = TRUE)
combinePlotsBSL(list(result1, result2, result3), label = c("BSL","uBSL","semiBSL"), thin = 20)

## End(Not run)


[Package BSL version 3.2.5 Index]