Re: [R] comparing fit of cubic spline

2007-05-30 Thread Simon Wood
On Monday 21 May 2007 16:17, Thomas Reed wrote:
 I want to compare the fit of a quadratic model to continuous data, with
 that of a cubic spline fit. Is there a way of computing AIC from for e.g. a
 GAM with a smoothing spine, and comparing this to AIC from a quadratic
 model?
library(mgcv)
AIC(gam(y~s(x))) ## a `generalized aic' since effective df used 
AIC(gam(y~x+I(x^2)))





 Cheers



 **

 Tom Reed
 PhD Student
 Institute of Evolutionary Biology
 102 Ashworth Laboratories
 Kings Buildings
 University of Edinburgh
 Edinburgh EH9 3JT



 [EMAIL PROTECTED]


 Tel. 00 44 (0)131 6505462
 http://homepages.ed.ac.uk/ecunning/tom.html
 http://homepages.ed.ac.uk/loeske/tom.html

 **




   [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch 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.

-- 
 Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
 +44 1225 386603  www.maths.bath.ac.uk/~sw283

__
R-help@stat.math.ethz.ch 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.


[R] comparing fit of cubic spline

2007-05-21 Thread Thomas Reed
I want to compare the fit of a quadratic model to continuous data, with that
of a cubic spline fit. Is there a way of computing AIC from for e.g. a GAM
with a smoothing spine, and comparing this to AIC from a quadratic model?

 

Cheers

 

**

Tom Reed
PhD Student
Institute of Evolutionary Biology
102 Ashworth Laboratories
Kings Buildings
University of Edinburgh
Edinburgh EH9 3JT



[EMAIL PROTECTED]


Tel. 00 44 (0)131 6505462
http://homepages.ed.ac.uk/ecunning/tom.html
http://homepages.ed.ac.uk/loeske/tom.html

**

 


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] comparing fit of cubic spline

2007-05-21 Thread Ben Bolker
Thomas Reed tom.reed at ed.ac.uk writes:

 
 I want to compare the fit of a quadratic model to continuous data, with that
 of a cubic spline fit. Is there a way of computing AIC from for e.g. a GAM
 with a smoothing spine, and comparing this to AIC from a quadratic model?
  
  Why don't you try AIC() on each of the fitted models and
see what happens?  In general R can compute log-likelihoods
and AICs for most fitted model objects ...  If it doesn't work,
you can post your simple example to the list and get more
advice then ...

  Ben Bolker

__
R-help@stat.math.ethz.ch 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.