Learn R Programming

rkriging (version 1.0.2)

Predict.Kriging: Kriging Prediction

Description

This function gives prediction and uncertainty quantification of the kriging model on a new input.

Usage

Predict.Kriging(kriging, X)

Value

mean

kriging mean computed at the new input

sd

kriging standard computed at the new input

Arguments

kriging

a kriging class object

X

a matrix for the new input (features) to perform predictions

Author

Chaofan Huang and V. Roshan Joseph

References

Joseph, V. R. (2006). Limit kriging. Technometrics, 48(4), 458-466.

Joseph, V. R. (2024). Rational Kriging. Journal of the American Statistical Association.

Rasmussen, C. E. & Williams, C. K. (2006). Gaussian Processes for Machine Learning. The MIT Press.

Santner, T. J., Williams, B. J., Notz, W. I., & Williams, B. J. (2003). The design and analysis of computer experiments (Vol. 1). New York: Springer.

See Also

Fit.Kriging.

Examples

Run this code
# one dimensional example 
f <- function(x) {
  x <- 0.5 + 2*x
  y <- sin(10*pi*x)/(2*x) + (x-1)^4
  return (y)
}

set.seed(1234)
# train set
n <- 30
p <- 1
X <- matrix(runif(n),ncol=p)
y <- apply(X, 1, f)
newX <- matrix(seq(0,1,length=1001), ncol=p)

kriging <- Fit.Kriging(X, y, interpolation=TRUE, fit=TRUE, model="OK",
                       kernel.parameters=list(type="Gaussian"))
pred <- Predict.Kriging(kriging, newX)
plot(newX, f(newX), "l")
points(X, y, pch=16, col="blue")
lines(newX, pred$mean, col="red", lty=2)
lines(newX, pred$mean-2*pred$sd, col="red", lty=3)
lines(newX, pred$mean+2*pred$sd, col="red", lty=3)

Run the code above in your browser using DataLab