[R] Question about GAMs

Gavin Simpson gavin.simpson at ucl.ac.uk
Thu Oct 13 17:38:09 CEST 2011


On Thu, 2011-10-13 at 08:20 -0700, pigpigmeow wrote:
> I'm confused...
> I type ..
> predict.gam(ozonea,type=s(ratio,bs="cr"))

That is not a valid 'type'; normally you'd use `type = "terms"` or `type
= "iterms"`, depending on whether you want (any) standard errors to
include the uncertainty about the intercept. 

>   pressure      maxtemp   s(avetemp)     s(ratio)
> 1   -0.0459102290 -0.185178463  0.263358446 -0.164558673
> 2   -0.0286464652 -0.194731320  0.199315027  0.727823293
> 3    0.0478073459 -0.013227033  0.002228896  0.342373202
> 4   -0.0089164494  0.082301539 -0.037331159 -0.067260889
> 5    0.0675373617  0.024984396 -0.047067786 -0.357569389
> 6    0.0823348735  0.101407254 -0.075884852 -1.485036738
> 7   -0.0977015204  0.177830112 -0.094755158  0.236575309
> 8   -0.0903027645  0.225594398 -0.113346667  0.435141242
> 9    0.0206785742  0.187382969 -0.066346157 -0.256133513
> 10  -0.1371615520  0.101407254 -0.131656887  0.145057584
> 11  -0.0477674066 -0.181001505  0.260279546  0.180513043
> 12  -0.0921599421 -0.009050075 -0.020511366  0.281470433
> 13   0.0681464361 -0.219212934  0.335348247  0.270813178
> ......
> 
> I want to show s(ratio,bs="cr") term, and show the warning message
> Warning message:
> In predict.gam(ozonea, type = s(ratio, bs = "cr")) :
>   Unknown type, reset to terms.
> 
> I don't understand what does it mean.

So if the above comments I made are not sufficient to explain this,
read ?predict.gam and see what the allowed options for the 'type'
argument are.

G

> By the way, i use log-link function, 
> should I convert log-link function of newozone to fitted value of newozone?
> 1. log(newozone) - s(ratio,bs="cr") = x
> then   exp(x)
> 
> 2. exp(newozone) - s(ratio,bs="cr") =X
> then x
> 
> which one is correct?
> so confused
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Question-about-GAMs-tp3900848p3901842.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.

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list