predict.km: PredictedValues and Confidence Intervals

View source: R/kmStuff.R

predict.kmR Documentation

PredictedValues and Confidence Intervals

Description

Overload the predict method of the class "km" of the DiceKriging package in order make possible the computation of derivatives.

Usage

## S3 method for class 'km'
predict(
  object,
  newdata,
  type,
  se.compute = TRUE,
  cov.compute = FALSE,
  light.return = FALSE,
  bias.correct = FALSE,
  checkNames = TRUE,
  deriv = FALSE,
  ...
)

Arguments

object, newdata, type

see predict.km.

se.compute, cov.compute

see predict.km.

light.return, bias.correct

see predict.km.

checkNames

see predict.km.

deriv

Logical. If TRUE further elements are added to the returned list, all concerning the the derivatives.

...

Not used yet.

Details

When deriv is TRUE "Jacobian" arrays are returned with the following rule. For a function F(X) with a c(q, d) matrix argument and a c(n, m) matrix value, the Jacobian array has dimension c(n, m, q, d) and element

DF(X)[i, j, k, ell] = dF[i, j] / dX[k, ell].

This rule is compatible with the R arrays indexation rule: if the function is considered as a function of a vector argument as.vector(X) with the vector value as.vector(F(X)), then by simply changing the dim attribute of the Jacobian matrix, we get the Jacobian array as described.

Value

A list with the elements of predict.km plus the following elements that relate to the derivatives w.r.t. the input

  • trend.deriv Derivative of the trend component. This is an array with dimension c(nNew, nNew, d).

  • mean.deriv, s2.deriv Derivatives of the kriging mean and kriging variance. These are arrays with dimension c(nNew, nNew, d).

  • cov.deriv Derivative of the kriging covariance. This is a four-dimensional array with dimension c(nNew, nNew, nNew, d).

Caution

XXXY remettre "method predict km" dans le roxygen

Examples

## a 16-points factorial design, and the corresponding response

d <- 2; n <- 16
X  <- expand.grid(x1 = seq(0, 1, length = 4), x2 = seq(0, 1, length = 4))
y <- apply(X, MARGIN = 1, FUN = branin)

## kriging model 1 : gaussian covariance structure, no trend,
##                   no nugget effect
myKm <- km(~1 + x1 + x2, design = X, response = y, covtype = "gauss")

## predicting at new points
XNew <- expand.grid(x1 = s <- seq(0, 1, length = 15), x2 = s)
pred <- predict(myKm, newdata = XNew[10, ], type = "UK", deriv = TRUE)
newdata <- XNew[10, ]
c.newdata <- covMat1Mat2(object = myKm@covariance,
                         X1 = myKm@X, X2 = matrix(newdata, nrow = 1),
                         nugget.flag = myKm@covariance@nugget.flag)
covVector.dx(x = newdata, X = myKm@X,
             object = myKm@covariance,
             c = c.newdata)
trend.deltax(x = newdata, model = myKm)


libKriging/dolka documentation built on April 14, 2022, 7:17 a.m.