# leaveOneOutFun.Kriging: Leave-One-Out Method for the S3 class '"Kriging"' In rlibkriging: Kriging Models using the 'libKriging' Library

 leaveOneOutFun.Kriging R Documentation

## Leave-One-Out Method for the S3 class "Kriging"

### Description

Compute Leave-One-Out (LOO) error for an object with S3 class "Kriging" representing a kriging model.

### Usage

## S3 method for class 'Kriging'
leaveOneOutFun(object, theta, grad = FALSE, ...)


### Arguments

 object A Kriging object. theta A numeric vector of range parameters at which the LOO will be evaluated. grad Logical. Should the gradient (w.r.t. theta) be returned? ... Not used.

### Details

The returned value is the sum of squares ∑_{i=1}^n [y_i - \hat{y}_{i,(-i)}]^2 where \hat{y}_{i,(-i)} is the prediction of y[i] based on the the observations y[j] with j != i.

### Value

The leave-One-Out value computed for the given vector θ of correlation ranges.

### Author(s)

Yann Richet yann.richet@irsn.fr

### Examples

f <- function(x) 1 - 1 / 2 * (sin(12 * x) / (1 + x) + 2 * cos(7 * x) * x^5 + 0.7)
set.seed(123)
X <- as.matrix(runif(10))
y <- f(X)

k <- Kriging(y, X, kernel = "matern3_2", objective = "LOO", optim="BFGS")
print(k)

loo <-  function(theta) leaveOneOutFun(k, theta)$leaveOneOut t <- seq(from = 0.001, to = 2, length.out = 101) plot(t, loo(t), type = "l") abline(v = k$theta(), col = "blue")


rlibkriging documentation built on Sept. 22, 2022, 5:07 p.m.