## Not run:
# ## generate some data
# set.seed(121)
# n <- 500
#
# ## regressors
# dat <- data.frame(x = runif(n, -3, 3), z = runif(n, 0, 1),
# w = runif(n, 0, 3))
#
# ## generate response
# dat$y <- with(dat, 1.5 + sin(x) + z -3 * w + rnorm(n, sd = 0.6))
#
# ## estimate model
# b <- bayesx(y ~ sx(x) + z + w, data = dat)
#
# ## create some data for which predictions are required
# nd <- data.frame(x = seq(2, 5, length = 100), z = 1, w = 0)
#
# ## prediction model from refitting with weights
# nd$fit <- predict(b, newdata = nd)
# plot(fit ~ x, type = "l", data = nd)
# ## End(Not run)
Run the code above in your browser using DataLab