synLikeMisspec {BSL}R Documentation

Estimate the Gaussian synthetic (log) likelihood whilst acknowledging model incompatibility


This function estimates the Gaussian synthetic likelihood whilst acknowledging that there may be incompatibility between the model and the observed summary statistic. The method has two different ways to account for and detect incompatibility (mean adjustment and variance inflation). An additional free parameter gamma is employed to account for the model misspecification. See the R-BSL methods of Frazier and Drovandi (2021) for more details. Note this function is mainly designed for interal use as the latent variable gamma need to be chosen otherwise. Alternatively, gamma is updated with a slice sampler (Neal 2003), which is the method of Frazier and Drovandi (2021).


  type = c("mean", "variance"),
  gamma = numeric(length(ssy)),
  log = TRUE,
  verbose = FALSE



The observed summary statisic.


A matrix of the simulated summary statistics. The number of rows is the same as the number of simulations per iteration.


A string argument indicating which method is used to account for and detect potential incompatibility. The two options are "mean" and "variance" for mean adjustment and variance inflation, respectively.


The additional latent parameter to account for possible incompatability between the model and observed summary statistic. In “BSLmisspec” method, this is updated with a slice sampler (Neal 2003). The default gamma implies no model misspecification and is equivalent to the standard gaussianSynLike estimator.


A logical argument indicating if the log of likelihood is given as the result. The default is TRUE.


A logical argument indicating whether an error message should be printed if the function fails to compute a likelihood. The default is FALSE.


The estimated synthetic (log) likelihood value.


Frazier DT, Drovandi C (2021). “Robust Approximate Bayesian Inference with Synthetic Likelihood.” Journal of Computational and Graphical Statistics (In Press).

Neal RM (2003). “Slice sampling.” The Annals of Statistics, 31(3), 705–767.

See Also

Other available synthetic likelihood estimators: gaussianSynLike for the standard synthetic likelihood estimator, gaussianSynLikeGhuryeOlkin for the unbiased synthetic likelihood estimator, semiparaKernelEstimate for the semi-parametric likelihood estimator, synLikeMisspec for the Gaussian synthetic likelihood estimator for model misspecification. Slice sampler to sample gamma sliceGammaMean and sliceGammaVariance (internal functions).


# a toy model (for details see section 4.1 from Frazier et al 2019)
# the true underlying model is a normal distribution with standard deviation equals to 0.2
# whist the data generation process has the standard deviation fixed to 1
y <- rnorm(50, 1, sd = 0.2)
ssy <- c(mean(y), var(y))
m <- newModel(fnSim = function(theta) rnorm(50, theta), fnSum = function(x) c(mean(x), var(x)),
              theta0 = 1, fnLogPrior = function(x) log(dnorm(x, sd = sqrt(10))))
ssx <- simulation(m, n = 300, theta = 1, seed = 10)$ssx

# gamma is updated with a slice sampler
gamma <- rep(0.1, length(ssy))
synLikeMisspec(ssy, ssx, type = "variance", gamma = gamma)

[Package BSL version 3.2.4 Index]