[R] Question about GAMs

Simon Wood s.wood at bath.ac.uk
Thu Oct 13 15:09:55 CEST 2011


I'd be inclined to use predict(ozonea,type="terms") to extract the 
estimates of  s(ratio,bs = "cr")
that you need. But do you  really want newozone - s(ratio,bs="cr") when 
you've used a log link?

best,
Simon

On 10/13/2011 09:05 AM, 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-tp3900848p3900848.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list