### test function ###
f_x <- function(x) {
return(sin(2*pi*x) + x^2)
}
### training data ###
n <- 8
x <- runif(n, 0, 1)
y <- f_x(x)
### testing data ###
n.test <- 100
x.test <- runif(n.test, 0, 1)
y.test <- f_x(x.test)
### get parameter estimates ###
out <- mle_gp(y, x)
### prediction ###
pred <- predict_gp(out, x.test)
Run the code above in your browser using DataLab