[R] Simulate from a GAM model

From: Mark Lyman <mark.lyman_at_gmail.com>
Date: Tue, 01 Jul 2008 17:12:44 +0000 (UTC)


Does anybody have any suggestions on how I might simulate from fitted GAM model? I am using the gam function in the mgcv package to fit a variable coefficient model like the following from the examples. I would like simulate based on the fitted model like the simulate function in the stats package does for lm models.

library(mgcv)
set.seed(10)
## simulate date from y = f(x2)*x1 + error
dat <- gamSim(3,n=400)
b<-gam(y ~ s(x2,by=x1),data=dat)

Thanks for any help you can give,
Mark Lyman



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 01 Jul 2008 - 17:59:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 01 Jul 2008 - 22:31:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive