# predict.NuggetKriging: Predict from a 'NuggetKriging' object. In rlibkriging: Kriging Models using the 'libKriging' Library

 predict.NuggetKriging R Documentation

## Predict from a `NuggetKriging` object.

### Description

Given "new" input points, the method compute the expectation, variance and (optionnally) the covariance of the corresponding stochastic process, conditional on the values at the input points used when fitting the model.

### Usage

``````## S3 method for class 'NuggetKriging'
predict(object, x, stdev = TRUE, cov = FALSE, deriv = FALSE, ...)
``````

### Arguments

 `object` S3 NuggetKriging object. `x` Input points where the prediction must be computed. `stdev` `Logical`. If `TRUE` the standard deviation is returned. `cov` `Logical`. If `TRUE` the covariance matrix of the predictions is returned. `deriv` `Logical`. If `TRUE` the derivatives of mean and sd of the predictions are returned. `...` Ignored.

### Value

A list containing the element `mean` and possibly `stdev` and `cov`.

### Note

The names of the formal arguments differ from those of the `predict` methods for the S4 classes `"km"` and `"KM"`. The formal `x` corresponds to `newdata`, `stdev` corresponds to `se.compute` and `cov` to `cov.compute`. These names are chosen Python and Octave interfaces to libKriging.

### 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) + 0.1 * rnorm(nrow(X))
points(X, y, col = "blue", pch = 16)

k <- NuggetKriging(y, X, "matern3_2")

## include design points to see interpolation
x <- sort(c(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))
``````

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