# \donttest{
### training data ###
n <- 8
### test function ###
f_x <- function(x) {
return(sin(2*pi*x) + x^2)
}
### generate x ###
x <- runif(n, 0, 1)
y <- f_x(x)
### k-fold cross validation ###
cv.lambda <- gp_cv(y, x, k=4)
### fit the model ###
penalized.mle <- mle_penalty(cv.lambda)
#### use the one standard error rule ###
penalized.mle <- mle_penalty(cv.lambda, one.se=TRUE)
### specify lambda ###
penalized.mle <- mle_penalty(cv.lambda, lambda=cv.lambda$lambda.score.max)
# }
Run the code above in your browser using DataLab