if (FALSE) {
## generate some data
set.seed(121)
n <- 200
## regressors
dat <- data.frame(x = runif(n, -3, 3))
## generate response
dat$y <- with(dat, 1.5 + sin(x) + rnorm(n, sd = 0.6))
## estimate model
b <- bayesx(y ~ sx(x), data = dat, method = "REML")
## extract GCV
GCV(b)
}
Run the code above in your browser using DataLab