update.NoiseKriging: Update a 'NoiseKriging' model object with new points

View source: R/NoiseKrigingClass.R

update.NoiseKrigingR Documentation

Update a NoiseKriging model object with new points

Description

Update a NoiseKriging model object with new points

Usage

## S3 method for class 'NoiseKriging'
update(object, newy, newnoise, newX, ...)

Arguments

object

S3 NoiseKriging object.

newy

Numeric vector of new responses (output).

newnoise

Numeric vector of new noise variances (output).

newX

Numeric matrix of new input points.

...

Ignored.

Value

No return value. NoiseKriging object argument is modified.

Caution

The method does not return the updated object, but instead changes the content of object. This behaviour is quite unusual in R and differs from the behaviour of the methods update.km in DiceKriging and update,KM-method.

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)
plot(f)
set.seed(123)
X <- as.matrix(runif(10))
y <- f(X) + X/10 * rnorm(nrow(X))
points(X, y, col = "blue")

k <- NoiseKriging(y, (X/10)^2, X, "matern3_2")

x <- seq(from = 0, to = 1, length.out = 101)
p <- predict(k, x)
lines(x, p$mean, col = "blue")
polygon(c(x, rev(x)), c(p$mean - 2 * p$stdev, rev(p$mean + 2 * p$stdev)),
 border = NA, col = rgb(0, 0, 1, 0.2))

newX <- as.matrix(runif(3))
newy <- f(newX) + 0.1 * rnorm(nrow(newX))
points(newX, newy, col = "red")

## change the content of the object 'k'
update(k, newy, rep(0.1^2,3), newX)

x <- seq(from = 0, to = 1, length.out = 101)
p2 <- predict(k, x)
lines(x, p2$mean, col = "red")
polygon(c(x, rev(x)), c(p2$mean - 2 * p2$stdev, rev(p2$mean + 2 * p2$stdev)),
 border = NA, col = rgb(1, 0, 0, 0.2))

rlibkriging documentation built on July 9, 2023, 5:53 p.m.