BSL-class {BSL}R Documentation

S4 class “BSL”.

Description

The S4 class “BSL” is produced by running function bsl and contains the result of a BSL run. Basic S4 methods show, summary and plot are provided. theta and loglike returns the MCMC samples of parameter values and estimated log-likelihoods.

Usage

## S4 method for signature 'BSL'
show(object)

## S4 method for signature 'BSL'
summary(object, burnin = 0, thetaNames = NULL)

## S4 method for signature 'BSL,ANY'
plot(
  x,
  which = 1L,
  thin = 1,
  burnin = 0,
  thetaTrue = NULL,
  options.plot = NULL,
  top = "Approximate Univariate Posteriors",
  options.density = list(),
  options.theme = list()
)

## S4 method for signature 'BSL'
getTheta(object, burnin = 0, thin = 1)

## S4 method for signature 'BSL'
getLoglike(object, burnin = 0, thin = 1)

## S4 method for signature 'BSL'
getGamma(object, burnin = 0, thin = 1)

Arguments

object

A “BSL” class object.

burnin

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

thetaNames

Parameter names to be shown in the summary table. If not given, parameter names of the “BSL” object will be used by default.

x

A “BSL” class object to plot.

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.

thetaTrue

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

options.plot

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

top

A character argument of the combined plot title if which is 2L.

options.density

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

options.theme

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

Slots

theta

Object of class “matrix”. MCMC samples from the joint approximate posterior distribution of the parameters.

loglike

Object of class “numeric”. Accepted MCMC samples of the estimated log-likelihood values.

call

Object of class “call”. The original code that was used to call the method.

model

Object of class “MODEL”.

acceptanceRate

Object of class “numeric”. The acceptance rate of the MCMC algorithm.

earlyRejectionRate

Object of class “numeric”. The early rejection rate of the algorithm (early rejection may occur when using bounded prior distributions).

errorRate

Object of class “numeric”. The error rate. If any infinite summary statistic or infinite log-likelihood estimate occurs during the process, it is marked as an error and the proposed parameter will be rejected.

y

Object of class “ANY”. The observed data.

n

Object of class “numeric”. The number of simulations from the model per MCMC iteration to estimate the synthetic likelihood.

M

Object of class “numeric”. The number of MCMC iterations.

covRandWalk

Object of class “matrix”. The covariance matrix used in multivariate normal random walk proposals.

method

Object of class “character”. The character argument indicating the used method.

shrinkage

Object of class “characterOrNULL”. The character argument indicating the shrinkage method.

penalty

Object of class “numericOrNULL”. The penalty value.

GRC

Object of class “logical”. Whether the Gaussian rank correlation matrix is used.

logitTransform

Object of class “logical”. The logical argument indicating whether a logit transformation is used in the algorithm.

logitTransformBound

Object of class “matrixOrNULL”. The matrix of logitTransformBound.

standardise

Object of class “logical”. The logical argument that determines whether to standardise the summary statistics.

parallel

Object of class “logical”. The logical value indicating whether parallel computing is used in the process.

parallelArgs

Object of class “listOrNULL”. The list of additional arguments to pass into the foreach function.

time

Object of class “difftime”. The running time.

gamma

Object of class “numeric”. MCMC samples of gamma parameter values of the mean adjustment or variance inflation for method “BSLmisspec”.

misspecType

Object of class “characterOrNULL”. The character argument indicating whether mean adjustment ("mean") or variance inflation ("variance") to be used in "BSLmisspec" method.

tau

Object of class “numeric”. Parameter of the prior distribution for "BSLmisspec" method. For mean adjustment, tau is the scale of the Laplace distribution. For variance inflation, tau is the mean of the exponential distribution.

whitening

Object of class “logicalOrMatrixOrNULL”. A logical argument determines whether Whitening transformation is used in “BSL” method with Warton's shrinkage, or just the Whitening matrix used.

Examples


## Not run: 
# a toy example
toy_simVec <- function(n, theta) matrix(rnorm(n, theta), nrow = n) # the simulation function
toy_sum <- function(x) x # the summary statistic function
model <- newModel(fnSimVec = toy_simVec, fnSum = toy_sum, theta0 = 0) # create the model object
result_toy <- bsl(y = 1, n = 100, M = 1e4, model = model, covRandWalk = matrix(1))
summary(result_toy)
plot(result_toy)

## End(Not run)


[Package BSL version 3.2.5 Index]