[R] Question about GAMs

Daniel Malter daniel at umd.edu
Thu Oct 13 14:55:06 CEST 2011


I am not an expert on this, but there is a way to check this. You can predict
from a gam using predict(ozonea, newdata=...). In the "newdata" argument you
can specify the X-values of interest to you. Thus, you can compare if your
predictions are the same when predicted directly from the gam or when
predicted by hand.

HTH,
Daniel



pigpigmeow wrote:
> 
> hi! I hope all of you can help me this question
> 
> for example GAMs:
> 
> ozonea<-gam(newozone~
> pressure+maxtemp+s(avetemp,bs="cr")+s(ratio,bs="cr"),family=gaussian
> (link=log),groupA,methods=REML)
> 
> 
> formula(ozonea)
> newozone ~ pressure + maxtemp + s(avetemp, bs = "cr") + s(ratio,bs = "cr")
> #formula of gams
> 
> coef(ozonea) # extract the coefficient of GAMs
>  (Intercept)     pressure      maxtemp s(avetemp).1 s(avetemp).2
> s(avetemp).3 s(avetemp).4 s(avetemp).5 s(avetemp).6 s(avetemp).7
> s(avetemp).8 s(avetemp).9   s(ratio).1 
>  2.848204561 -0.024662520 -0.095528572 -0.052613005 -0.135309283 
> 0.066243642  0.030937179  0.176267227  0.243405931  0.357027920 
> 0.600628869  0.758581430  0.004653696 
>   s(ratio).2   s(ratio).3   s(ratio).4   s(ratio).5   s(ratio).6  
> s(ratio).7   s(ratio).8   s(ratio).9 
>  0.156547789 -0.132527837 -0.179947367 -0.208918785 -0.468014803
> -0.195498523 -0.813667830 -1.505844690 
> 
> then, I want to calculate 
> newozone - s(ratio,bs="cr")
> we define this term (newozone - s(ratio,bs="cr")) is X
> can i use the coefficient to calculate?
> 

--
View this message in context: http://r.789695.n4.nabble.com/Question-about-GAMs-tp3900848p3901383.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list