load_mgcv()
dat <- data_sim("eg1", n = 400, dist = "normal", scale = 2, seed = 2)
m1 <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat, method = "REML")
sims <- simulate(m1, nsim = 5, seed = 42)
head(sims)
Run the code above in your browser using DataLab