evidence {ZVCV} | R Documentation |
Evidence estimation with ZV-CV
Description
The functions evidence_CTI
and evidence_CTI_CF
can be used to improve upon the thermodynamic integration (TI) estimate of the normalising constant with ZV-CV and CF, respectively. The functions evidence_SMC
and evidence_SMC_CF
do the same thing for the sequential Monte Carlo (SMC) normalising constant identity.
Usage
evidence_CTI(
samples,
loglike,
der_loglike,
der_logprior,
temperatures,
temperatures_all,
most_recent,
est_inds,
options,
folds = 5
)
evidence_CTI_CF(
samples,
loglike,
der_loglike,
der_logprior,
temperatures,
temperatures_all,
most_recent,
est_inds,
steinOrder,
kernel_function,
sigma_list,
folds = 5
)
evidence_SMC(
samples,
loglike,
der_loglike,
der_logprior,
temperatures,
temperatures_all,
most_recent,
est_inds,
options,
folds = 5
)
evidence_SMC_CF(
samples,
loglike,
der_loglike,
der_logprior,
temperatures,
temperatures_all,
most_recent,
est_inds,
steinOrder,
kernel_function,
sigma_list,
folds = 5
)
Arguments
samples |
An |
loglike |
An |
der_loglike |
An |
der_logprior |
An |
temperatures |
A vector of length |
temperatures_all |
An adjusted vector of length |
most_recent |
A vector of length |
est_inds |
(optional) A vector of indices for the estimation-only samples. The default when |
options |
A list of control variate specifications for ZV-CV. This can be a single list containing the elements below (the defaults are used for elements which are not specified). Alternatively, it can be a list of lists containing any or all of the elements below. Where the latter is used, the function |
folds |
The number of folds used in k-fold cross-validation for selecting the optimal control variate. For ZV-CV, this may include selection of the optimal polynomial order, regression type and subset of parameters depending on |
steinOrder |
(optional) This is the order of the Stein operator. The default is |
kernel_function |
(optional) Choose between "gaussian", "matern", "RQ", "product" or "prodsim". See below for further details. |
sigma_list |
(optional between this and |
Value
The function evidence_CTI
returns a list, containing the following components:
-
log_evidence_PS1
: The 1st order quadrature estimate for the log normalising constant -
log_evidence_PS2
: The 2nd order quadrature estimate for the log normalising constant -
regression_LL
: The set oftau
zvcv
type returns for the 1st order quadrature expectations -
regression_vLL
: The set oftau
zvcv
type returns for the 2nd order quadrature expectations
The function evidence_CTI_CF
returns a list, containing the following components:
-
log_evidence_PS1
: The 1st order quadrature estimate for the log normalising constant -
log_evidence_PS2
: The 2nd order quadrature estimate for the log normalising constant -
regression_LL
: The set oftau
CF_crossval
type returns for the 1st order quadrature expectations -
regression_vLL
: The set oftau
CF_crossval
type returns for the 2nd order quadrature expectations -
selected_LL_CF
: The set oftau
selected tuning parameters fromsigma_list
for the 1st order quadrature expectations. -
selected_vLL_CF
: The set oftau
selected tuning parameters fromsigma_list
for the 2nd order quadrature expectations.
The function evidence_SMC
returns a list, containing the following components:
-
log_evidence
: The logged SMC estimate for the normalising constant -
regression_SMC
: The set oftau
zvcv
type returns for the expectations
The function evidence_SMC_CF
returns a list, containing the following components:
-
log_evidence
: The logged SMC estimate for the normalising constant -
regression_SMC
: The set oftau
CF_crossval
type returns for the expectations -
selected_CF
: The set oftau
selected tuning parameters fromsigma_list
for the expectations
On the choice of \sigma
, the kernel and the Stein order
The kernel in Stein-based kernel methods is L_x L_y k(x,y)
where L_x
is a first or second order Stein operator in x
and k(x,y)
is some generic kernel to be specified.
The Stein operators for distribution p(x)
are defined as:
-
steinOrder=1
:L_x g(x) = \nabla_x^T g(x) + \nabla_x \log p(x)^T g(x)
(see e.g. Oates el al (2017)) -
steinOrder=2
:L_x g(x) = \Delta_x g(x) + \nabla_x log p(x)^T \nabla_x g(x)
(see e.g. South el al (2020))
Here \nabla_x
is the first order derivative wrt x
and \Delta_x = \nabla_x^T \nabla_x
is the Laplacian operator.
The generic kernels which are implemented in this package are listed below. Note that the input parameter sigma
defines the kernel parameters \sigma
.
-
"gaussian"
: A Gaussian kernel,k(x,y) = exp(-z(x,y)/\sigma^2)
-
"matern"
: A Matern kernel with\sigma = (\lambda,\nu)
,k(x,y) = bc^{\nu}z(x,y)^{\nu/2}K_{\nu}(c z(x,y)^{0.5})
where
b=2^{1-\nu}(\Gamma(\nu))^{-1}
,c=(2\nu)^{0.5}\lambda^{-1}
andK_{\nu}(x)
is the modified Bessel function of the second kind. Note that\lambda
is the length-scale parameter and\nu
is the smoothness parameter (which defaults to 2.5 forsteinOrder=1
and 4.5 forsteinOrder=2
). -
"RQ"
: A rational quadratic kernel,k(x,y) = (1+\sigma^{-2}z(x,y))^{-1}
-
"product"
: The product kernel that appears in Oates et al (2017) with\sigma = (a,b)
k(x,y) = (1+a z(x) + a z(y))^{-1} exp(-0.5 b^{-2} z(x,y))
-
"prodsim"
: A slightly different product kernel with\sigma = (a,b)
(see e.g. https://www.imperial.ac.uk/inference-group/projects/monte-carlo-methods/control-functionals/),k(x,y) = (1+a z(x))^{-1}(1 + a z(y))^{-1} exp(-0.5 b^{-2} z(x,y))
In the above equations, z(x) = \sum_j x[j]^2
and z(x,y) = \sum_j (x[j] - y[j])^2
. For the last two kernels, the code only has implementations for steinOrder
=1
. Each combination of steinOrder
and kernel_function
above is currently hard-coded but it may be possible to extend this to other kernels in future versions using autodiff. The calculations for the first three kernels above are detailed in South et al (2020).
Author(s)
Leah F. South
References
Mira, A., Solgi, R., & Imparato, D. (2013). Zero variance Markov chain Monte Carlo for Bayesian estimators. Statistics and Computing, 23(5), 653-662.
South, L. F., Oates, C. J., Mira, A., & Drovandi, C. (2019). Regularised zero variance control variates for high-dimensional variance reduction. https://arxiv.org/abs/1811.05073
See Also
See an example at VDP
and see ZVCV for more package details. See Expand_Temperatures
for a function that can be used to find stricter (or less stricter) temperature schedules based on the conditional effective sample size.