% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/KrigingClass.R
\name{update.Kriging}
\alias{update.Kriging}
\title{Update a \code{Kriging} model object with new points}
\usage{
\method{update}{Kriging}(object, y_u, ..., X_u = NULL, noise_u = NULL, refit = TRUE)
}
\arguments{
\item{object}{S3 Kriging object.}

\item{y_u}{Numeric vector of new responses (output).}

\item{...}{Ignored.}

\item{X_u}{Numeric matrix of new input points.}

\item{noise_u}{Optional numeric vector of observation noise variances
attached to \code{y_u}.}

\item{refit}{Logical. If \code{TRUE} the model is refitted (default is \code{TRUE}).}
}
\value{
No return value. Kriging object argument is modified.
}
\description{
Update a \code{Kriging} model object with new points
}
\section{Caution}{
 The method \emph{does not return the updated
    object}, but instead changes the content of
    \code{object}. This behaviour is quite unusual in R and
    differs from the behaviour of \code{\link[DiceKriging]{update.km}}
    in \pkg{DiceKriging} and the \code{update} method for class
    \code{KM}.
}

\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)
points(X, y, col = "blue")

k <- Kriging(y, 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))

X_u <- as.matrix(runif(3))
y_u <- f(X_u)
points(X_u, y_u, col = "red")

## change the content of the object 'k'
update(k, y_u, X_u)

## include design points to see interpolation
x <- sort(c(X,X_u,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))
}
\author{
Yann Richet \email{yann.richet@asnr.fr}
}
