Hi, Is there any difference in the gam() function in R and Splus? I just tried to do an Ace Plot (plotting the result of the gam() ) on a dataset. R gave me four (the data set has one response and four explanatory variables) ace plot with perfectly straight lines. I kind of felt that it is highly unlikely, so I tried it in Splus. Using the exact commands Splus gave me four completely different ace plots (in fact so different that three of them suggested a quadratic polynomial transformation). Am I doing something wrong here? Cheers, Kevin ------------------------------------------------------------------------------ Ko-Kang Kevin Wang Statistical Analysis Division Leader Software Developers' Klub (SDK) University of Auckland New Zealand -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sat, 18 Aug 2001, Ko-Kang Kevin Wang wrote:> Hi, > > Is there any difference in the gam() function in R and Splus?See Q7.18 in the FAQ! They are quite different: in particular that in R's mgcv does model selection and that in S-PLUS does not.> I just tried to do an Ace Plot (plotting the result of the gam() ) on a > dataset. R gave me four (the data set has one response and four > explanatory variables) ace plot with perfectly straight lines. I kind of > felt that it is highly unlikely, so I tried it in Splus. Using the exact > commands Splus gave me four completely different ace plots (in fact so > different that three of them suggested a quadratic polynomial > transformation). > > Am I doing something wrong here?Something different, anyway. mgcv's gam() can choose a linear model. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> Is there any difference in the gam() function in R and Splus?- there are quite alot of differences: see latest issue of Rnews [Perhaps I shouldn't have called it "gam()" - but this does describe what it does].> > I just tried to do an Ace Plot (plotting the result of the gam() ) on a > dataset. R gave me four (the data set has one response and four > explanatory variables) ace plot with perfectly straight lines. I kind of > felt that it is highly unlikely, so I tried it in Splus. Using the exact > commands Splus gave me four completely different ace plots (in fact so > different that three of them suggested a quadratic polynomial > transformation).- As Brian Ripley pointed out, the difference here is that mgcv's gam() is doing model selection for you. If you want something more like an Splus GAM then you can fix the degrees of freedom for each the model terms - e.g.> gam(y~s(x,5|f)) # fits 4 df regression splinethen you should find a closer correspondance between what you get from R/mgcv and what you get from Splus. mgcv has a tendancy to select too many straight lines if your predictor variables are highly correlated. I would check for this and try dropping some terms (again, see current Rnews). Finally: how many data do you have? GCV will tend to suggest smoothing quite heavily if there are very few data. Simon ______________________________________________________________________> Simon Wood snw at st-and.ac.uk http://www.ruwpa.st-and.ac.uk/simon.html > The Mathematical Institute, North Haugh, St. Andrews, Fife KY16 9SS UK > Direct telephone: (0)1334 463799 Indirect fax: (0)1334 463748-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._