covANOVA {kergp}R Documentation

Creator for the Class "covANOVA"

Description

Creator for the class "covANOVA".

Usage

covANOVA(k1Fun1 = k1Fun1Gauss,
      cov = c("corr", "homo"),
      iso = 0, iso1 = 1L,
      hasGrad = TRUE,
      inputs = NULL,
      d = NULL,
      parNames,
      par = NULL, parLower = NULL, parUpper = NULL,
      label = "ANOVA kernel",
      ...)

Arguments

k1Fun1

A kernel function of a scalar numeric variable, and possibly of an extra "shape" parameter. This function can also return the first-order derivative or the two-first order derivatives as an attribute with name "der" and with a matrix content. When an extra shape parameter exists, the gradient can also be returned as an attribute with name "gradient", see Examples later. The name of the function can be given as a character string.

cov

A character string specifying the value of the variance parameter \delta for the covariance kernel. Contrarily to other kernel classes, that parameter is not equal to the variance. Thus, mind that choosing ("corr") corresponds to \delta=1 but does not correspond to a correlation kernel, see details below. Partial matching is allowed.

iso

Integer. The value 1L corresponds to an isotropic covariance, with all the inputs sharing the same range value.

iso1

Integer. This applies only when k1Fun1 contains one or more parameters that can be called 'shape' parameters. At now, only one such parameter can be found in k1Fun1 and consequently iso1 must be of length one. With iso1 = 0 the shape parameter in k1Fun1 will generate d parameters in the covANOVA object with their name suffixed by the dimension. When iso1 is 1 only one shape parameter will be created in the covANOVA object.

hasGrad

Integer or logical. Tells if the value returned by the function k1Fun1 has an attribute named "der" giving the derivative(s).

inputs

Character. Names of the inputs.

d

Integer. Number of inputs.

parNames

Names of the parameters. By default, ranges are prefixed "theta_" in the non-iso case and the range is named "theta" in the iso case.

par

Numeric values for the parameters. Can be NA.

parLower

Numeric values for the lower bounds on the parameters. Can be -Inf.

parUpper

Numeric values for the upper bounds on the parameters. Can be Inf.

label

A short description of the kernel object.

...

Other arguments passed to the method new.

Details

A ANOVA kernel on the d-dimensional Euclidean space takes the form

K(\mathbf{x},\,\mathbf{x}') = \delta^2 \prod_{\ell = 1}^d (1 + \tau_\ell^2 \kappa(r_\ell))

where \kappa(r) is a suitable correlation kernel for a one-dimensional input, and r_\ell is given by r_\ell := [x_\ell - x'_\ell] / \theta_\ell for \ell = 1 to d.

In this default form, the ANOVA kernel depends on 2d + 1 parameters: the ranges \theta_\ell >0, the variance ratios \tau_\ell^2, and the variance parameter \delta^2.

An isotropic form uses the same range \theta for all inputs, i.e. sets \theta_\ell = \theta for all \ell. This is obtained by using iso = TRUE.

A correlation version uses \delta^2 = 1. This is obtained by using cov = "corr". Mind that it does not correspond to a correlation kernel. Indeed, in general, the variance is equal to

K(\mathbf{x},\,\mathbf{x}) = \delta^2 \prod_{\ell = 1}^d (1 + \tau_\ell^2).

Finally, the correlation kernel \kappa(r) can depend on a "shape" parameter, e.g. have the form \kappa(r;\,\alpha). The extra shape parameter \alpha will be considered then as a parameter of the resulting ANOVA kernel, making it possible to estimate it by ML along with the range(s) and the variance.

Value

An object with class "covANOVA".

Examples

## Not run: 
if (require(DiceKriging)) {
    ## a 16-points factorial design and the corresponding response
    d <- 2; n <- 16; x <- seq(from = 0.0, to = 1.0, length.out = 4)
    X <- expand.grid(x1 = x, x2 = x)
    y <- apply(X, 1, DiceKriging::branin)

    ## kriging model with matern5_2 covariance structure, constant
    ## trend. A crucial point is to set the upper bounds!
    mycov <- covANOVA(k1Fun1 = k1Fun1Matern5_2, d = 2, cov = "homo")
    coefUpper(mycov) <- c(2.0, 2.0, 5.0, 5.0, 1e10)
    mygp <- gp(y ~ 1, data = data.frame(X, y),
               cov = mycov, multistart = 100, noise = TRUE)

    nGrid <- 50; xGrid <- seq(from = 0, to = 1, length.out = nGrid)
    XGrid <- expand.grid(x1 = xGrid, x2 = xGrid)
    yGrid <- apply(XGrid, 1, DiceKriging::branin)
    pgp <- predict(mygp, XGrid)$mean

    mykm <- km(design = X, response = y)
    pkm <- predict(mykm, XGrid, "UK")$mean
    c("km" = sqrt(mean((yGrid - pkm)^2)),
      "gp" = sqrt(mean((yGrid - pgp)^2)))
    
}

## End(Not run)

[Package kergp version 0.5.7 Index]