update,NoiseKM-method | R Documentation |
NoiseKM
Object with New PointsThe update
method is used when new observations are added
to a fitted kriging model. Rather than fitting the model from
scratch with the updated observations added, the results of the
fit as stored in object
are used to achieve some savings.
## S4 method for signature 'NoiseKM'
update(
object,
newX,
newy,
newnoise.var,
newX.alreadyExist = FALSE,
cov.reestim = TRUE,
trend.reestim = cov.reestim,
nugget.reestim = FALSE,
kmcontrol = NULL,
newF = NULL,
...
)
object |
A NoiseKM object. |
newX |
A numeric matrix containing the new design points. It
must have |
newy |
A numeric vector of new response values, in
correspondence with the rows of |
newnoise.var |
Variance of an additional noise on the new response. |
newX.alreadyExist |
Logical. If TRUE, |
cov.reestim |
Logical. If |
trend.reestim |
Logical. If |
nugget.reestim |
Logical. If |
kmcontrol |
A list of options to tune the fit. Not available yet. |
newF |
New trend matrix. XXXY? |
... |
Ignored. |
Without a dedicated update
method for the class
"NoiseKM"
, this would have been inherited from the class
"km"
. The dedicated method is expected to run faster. A
comparison can be made by coercing a NoiseKM
object to a
km
object with as.km
before calling
update
.
The updated NoiseKM
object.
Yann Richet yann.richet@irsn.fr
as.km
to coerce a NoiseKM
object to the
class "km"
.
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(5))
y <- f(X) + 0.01*rnorm(nrow(X))
points(X, y, col = "blue")
KMobj <- NoiseKM(design = X, response = y, noise=rep(0.01^2,5), covtype = "gauss")
x <- seq(from = 0, to = 1, length.out = 101)
p_x <- predict(KMobj, x)
lines(x, p_x$mean, col = "blue")
lines(x, p_x$lower95, col = "blue")
lines(x, p_x$upper95, col = "blue")
newX <- as.matrix(runif(3))
newy <- f(newX) + 0.01*rnorm(nrow(newX))
points(newX, newy, col = "red")
## replace the object by its udated version
KMobj <- update(KMobj, newX=newX, newy=newy, newnoise.var=rep(0.01^2,3))
x <- seq(from = 0, to = 1, length.out = 101)
p2_x <- predict(KMobj, x)
lines(x, p2_x$mean, col = "red")
lines(x, p2_x$lower95, col = "red")
lines(x, p2_x$upper95, col = "red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.