covTP {kergp} | R Documentation |
Creator for the Class "covTP"
Description
Creator for the class "covTP"
.
Usage
covTP(k1Fun1 = k1Fun1Gauss,
cov = c("corr", "homo"),
iso = 0, iso1 = 1L,
hasGrad = TRUE,
inputs = NULL,
d = NULL,
parNames,
par = NULL, parLower = NULL, parUpper = NULL,
label = "Tensor product 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 |
cov |
A character string specifying the kind of covariance kernel:
correlation kernel ( |
iso |
Integer. The value |
iso1 |
Integer. This applies only when |
hasGrad |
Integer or logical. Tells if the value returned by the function
|
inputs |
Character. Names of the inputs. |
d |
Integer. Number of inputs. |
parNames |
Names of the parameters. By default, ranges are prefixed
|
par |
Numeric values for the parameters. Can be |
parLower |
Numeric values for the lower bounds on the parameters. Can be
|
parUpper |
Numeric values for the upper bounds on the parameters. Can be
|
label |
A short description of the kernel object. |
... |
Other arguments passed to the method |
Details
A tensor-product kernel on the d
-dimensional Euclidean space
takes the form
K(\mathbf{x},\,\mathbf{x}') = \sigma^2
\prod_{\ell = 1}^d \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 tensor-product kernel depends on d + 1
parameters: the ranges \theta_\ell >0
and
the variance \sigma^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 \sigma^2 = 1
. This is obtained by using cov = "corr"
.
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 tensor-product kernel, making it possible to estimate it
by ML along with the range(s) and the variance.
Value
An object with class "covTP"
.
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 <- covTP(k1Fun1 = k1Fun1Matern5_2, d = 2, cov = "homo")
coefUpper(mycov) <- c(2.0, 2.0, 1e10)
mygp <- gp(y ~ 1, data = data.frame(X, y),
cov = mycov, multistart = 100, noise = FALSE)
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)