SECF_crossval: Semi-exact control functionals (SECF) with cross-validation

Description Usage Arguments Value Warning On the choice of σ, the kernel and the Stein order Author(s) References See Also

View source: R/kernel_methods.R


This function chooses between a list of kernel tuning parameters (sigma_list) or a list of K0 matrices (K0_list) for the semi-exact control functionals method described in South et al (2020). The latter requires calculating and storing kernel matrices using K0_fn but it is more flexible because it can be used to choose the Stein operator order and the kernel function, in addition to its parameters. It is also faster to pre-specify K0_fn. For estimation with fixed kernel parameters, use SECF.


  polyorder = NULL,
  steinOrder = NULL,
  kernel_function = NULL,
  sigma_list = NULL,
  K0_list = NULL,
  est_inds = NULL,
  apriori = NULL,
  folds = NULL,
  diagnostics = FALSE



An N by k matrix of integrands (evaluations of the function of interest)


An N by d matrix of samples from the target


An N by d matrix of derivatives of the log target with respect to the parameters


(optional) The order of the polynomial to be used in the parametric component, with a default of 1. We recommend keeping this value low (e.g. only 1-2).


(optional) This is the order of the Stein operator. The default is 1 in the control functionals paper (Oates et al, 2017) and 2 in the semi-exact control functionals paper (South et al, 2020). The following values are currently available: 1 for all kernels and 2 for "gaussian", "matern" and "RQ". See below for further details.


(optional) Choose between "gaussian", "matern", "RQ", "product" or "prodsim". See below for further details.


(optional between this and K0_list) A list of tuning parameters for the specified kernel. This involves a list of single length-scale parameter in "gaussian" and "RQ", a list of vectors containing length-scale and smoothness parameters in "matern" and a list of vectors of the two parameters in "product" and "prodsim". See below for further details. When sigma_list is specified and not K0_list, the K0 matrix is computed twice for each selected tuning parameter.


(optional between this and sigma_list) A list of kernel matrices, which can be calculated using K0_fn.


(optional) A vector of indices for the estimation-only samples. The default when est_inds is missing or NULL is to perform both estimation of the control variates and evaluation of the integral using all samples. Otherwise, the samples from est_inds are used in estimating the control variates and the remainder are used in evaluating the integral. Splitting the indices in this way can be used to reduce bias from adaption and to make computation feasible for very large sample sizes (small est_inds is faster), but in general in will increase the variance of the estimator.


(optional) A vector containing the subset of parameter indices to use in the polynomial. Typically this argument would only be used if the dimension of the problem is very large or if prior information about parameter dependencies is known. The default is to use all parameters 1:d where d is the dimension of the target.


(optional) The number of folds for cross-validation. The default is five.


(optional) A flag for whether to return the necessary outputs for plotting or estimating using the fitted model. The default is false since this requires some additional computation when est_inds is NULL.


A list with the following elements:


Solving the linear system in SECF has O(N^3+Q^3) complexity where N is the sample size and Q is the number of terms in the polynomial. Standard SECF is therefore not suited to large N. The method aSECF is designed for larger N and details can be found at aSECF and in South et al (2020). An alternative would be to use est_inds which has O(N_0^3 + Q^3) complexity in solving the linear system and O((N-N_0)^2) complexity in handling the remaining samples, where N_0 is the length of est_inds. This can be much cheaper for large N but the estimation of the Gaussian process model is only done using N_0 samples and the evaluation of the integral only uses N-N_0 samples.

On the choice of σ, 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:

Here \nabla_x is the first order derivative wrt x and Δ_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 σ.

In the above equations, z(x) = ∑_j x[j]^2 and z(x,y) = ∑_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).


Leah F. South


Oates, C. J., Girolami, M. & Chopin, N. (2017). Control functionals for Monte Carlo integration. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 79(3), 695-718.

South, L. F., Karvonen, T., Nemeth, C., Girolami, M. and Oates, C. J. (2020). Semi-Exact Control Functionals From Sard's Method.

See Also

See ZVCV for examples and related functions. See SECF for a function to perform semi-exact control functionals with fixed kernel specifications.

ZVCV documentation built on June 30, 2021, 5:07 p.m.

Related to SECF_crossval in ZVCV...