f <- function(x) 1- 1 / 2 * (sin(12 * x) / (1 + x) + 2 * cos(7 * x)*x^5 + 0.7)
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")
print(k)
outfile = tempfile("k.json")
save(k,outfile)
print(load.NoiseKriging(outfile))
Run the code above in your browser using DataLab