I have 5 GAMs ( model1, model2, model3, model4 and model5) Before I use some data X(predictor -January to June data) to form a equation and calculate the expected value of Y (predictand -January to June). After variable selection, GAMs (Model 1)were bulit up! R-square :0.40 NOW, I want to use new X'( predictor -July - December data) and put into Model 1, then get the expected value of Y' (predictand-July -December) I used mcgv package, what should I do now? -- View this message in context: http://r.789695.n4.nabble.com/GAMs-in-R-How-to-put-the-new-data-into-the-model-tp3849851p3849851.html Sent from the R help mailing list archive at Nabble.com.
Daniel Malter
2011-Sep-28 05:31 UTC
[R] GAMs in R : How to put the new data into the model?
Your questions is pretty opaque. Please adhere to the posting guide. Provide a self-contained (!) example (i.e., code) that reproduces your problem. Generally, you would predict like this: x<-rnorm(100) e<-rnorm(100) y<-x+x^2+e reg<-gam(y~s(x)) plot(reg) predict(reg,newdata=data.frame(x=2)) where you can substitute any vector of values for x HTH, Daniel pigpigmeow wrote:> > I have 5 GAMs ( model1, model2, model3, model4 and model5) > Before I use some data X(predictor -January to June data) to form a > equation and calculate the expected value of Y (predictand -January to > June). After variable selection, GAMs (Model 1)were bulit up! R-square > :0.40 > > NOW, I want to use new X'( predictor -July - December data) and put into > Model 1, then get the expected value of Y' (predictand-July -December) > > I used mcgv package, what should I do now? >-- View this message in context: http://r.789695.n4.nabble.com/GAMs-in-R-How-to-put-the-new-data-into-the-model-tp3849851p3850063.html Sent from the R help mailing list archive at Nabble.com.
For example: GAMs and after stepwise regression: cod<-gam(newCO~RH+s(solar,bs="cr")+windspeed+s(transport,bs="cr"),family=gaussian (link=log),groupD,methods=REML) I used 10 year meterorology data (2000-2010) to form equation of concentration of carbon monoxide. NOW, I have 2011 meteorology data, I want to use the above GAMs to get the predict value of concentration of carbon monoxide. How can I put the 2011 data into this gam and get the expected value of concentration of Carbon monoxide?? -- View this message in context: http://r.789695.n4.nabble.com/GAMs-in-R-How-to-put-the-new-data-into-the-model-tp3849851p3850473.html Sent from the R help mailing list archive at Nabble.com.