Description Usage Arguments Value References See Also Examples
View source: R/synLikeMisspec.R
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
\insertCiteFrazier2019;textualBSL 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 \insertCiteNeal2003BSL, which is the method of
\insertCiteFrazier2019;textualBSL.
1 2 3 4 5 6 7 8 |
ssy |
The observed summary statisic. |
ssx |
A matrix of the simulated summary statistics. The number of rows is the same as the number of simulations per iteration. |
type |
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. |
gamma |
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
\insertCiteNeal2003BSL. The default gamma implies no model misspecification
and is equivalent to the standard |
log |
A logical argument indicating if the log of likelihood is
given as the result. The default is |
verbose |
A logical argument indicating whether an error message
should be printed if the function fails to compute a likelihood. The
default is |
The estimated synthetic (log) likelihood value.
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).
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 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
set.seed(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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.