[R] RDA and trend surface regression

Roger Bivand Roger.Bivand at nhh.no
Tue Feb 27 20:54:38 CET 2007


On Tue, 27 Feb 2007, Gavin Simpson wrote:

> On Tue, 2007-02-27 at 13:13 -0500, Kuhn, Max wrote:
> > Helene,
> > 
> > My point was only that RDA may fit a quadratic model for the terms
> > specified in your model. The terms that you had specified were already
> > higher order polynomials (some cubic). So a QDA classifier with the
> > model terms that you specified my be a fifth order polynomial in the
> > original data. I don't know the reference you cite or even the
> > subject-matter specifics. I'm just a simple cave man (for you SNL fans).
> > But I do know that there are more reliable ways to get nonlinear
> > classification boundaries than using x^5. 
> 
> I doubt that Helene is trying to do a classification - unless you
> consider classification to mean that all rows/samples are in different
> groups (i.e. n samples therefore n groups) - which is how RDA
> (Redundancy Analysis) is used in ecology.
> 
> You could take a look at multispati in package ade4 for a different way
> to handle spatial constraints. There is also the principle coordinates
> analysis of neighbour matrices (PCNM) method - not sure this is coded
> anywhere in R yet though. Here are two references that may be useful:
> 
> Dray, S., P. Legendre, and P. R. Peres- Neto. 2006. Spatial modeling: a
> comprehensive framework for principal coordinate analysis of neighbor
> matrices (PCNM). Ecological Modelling, in press.
> 
> Griffith, D. A., and P. R. Peres- Neto. 2006. Spatial modeling in
> ecology: the flexibility of eigenfunction spatial analyses. Ecology, in
> press.

Pedro Peres-Neto helped cast his matlab original to R as function ME() in
the spdep package, at least partly to see if it worked like
SpatialFiltering() in spdep, based on a forthcoming paper by Tiefelsdorf
and Griffith; code suggestions from Stéphane Dray were also used. For
sample data sets, including those used in the papers, ME() reproduces the
original results, and reproduces results from the matlab code from which
it was derived with possible differences for the stopping rule of the
semi-parametric stage - the Oribatid mites data set is in ade4.

Roger

> 
> HTH
> 
> G
> 
> > 
> > If you want a quadratic model, I would suggest that you use QDA with the
> > predictors in the original units (or see Hastie's book for a good
> > example of using higher order terms with LDA). 
> > 
> > Looking at your email, you want a "a variation partitioning analyses".
> > RDA works best as a classification technique. Perhaps a multivariate
> > ANOVA model may be a more direct way to meet your needs. There is a
> > connection between LDA and some multivariate linear models, but I don't
> > know of a similar connection to RDA.
> > 
> > Max
> > 
> > -----Original Message-----
> > From: MORLON [mailto:morlon.helene at gmail.com] 
> > Sent: Tuesday, February 27, 2007 12:53 PM
> > To: 'Jari Oksanen'; r-help at stat.math.ethz.ch
> > Cc: Kuhn, Max
> > Subject: RE: [R] RDA and trend surface regression
> > 
> > Thanks a lot for your answers,
> > 
> > I am concerned by your advice not to use polynomial constraints, or to
> > use
> > QDA instead of RDA. My final goal is to perform variation partitioning
> > using
> > partial RDA to assess the relative importance of environmental vs
> > spatial
> > variables. For the spatial analyses, trend surface analysis (polynomial
> > constraints) is recommended in Legendre and Legendre 1998 (p739). Is
> > there a
> > better method to integrate space as an explanatory variable in a
> > variation
> > partitioning analyses? 
> > 
> > Also, I don't understand this: when I test for the significant
> > contribution
> > of monomials (forward elimination)
> > 
> > >anova(rda(Helling ~ I(x^2)+Condition(x)+Condition(y)))
> > 
> > performs the permutation test as expected, whereas 
> > 
> > >anova(rda(Helling ~ I(y^2)+Condition(x)+Condition(y)))
> > 
> > Returns this error message:
> > 
> > Error in "names<-.default"(`*tmp*`, value = "Model") : 
> >         attempt to set an attribute on NULL
> > 
> > Thanks again for your help
> > Kind regards,
> > Helene
> > 
> > Helene MORLON
> > University of California, Merced
> > 
> > -----Original Message-----
> > From: Jari Oksanen [mailto:jarioksa at sun3.oulu.fi] 
> > Sent: Monday, February 26, 2007 11:27 PM
> > To: r-help at stat.math.ethz.ch
> > Cc: morlon.helene at gmail.com
> > Subject: [R] RDA and trend surface regression
> > 
> > 
> > > 'm performing RDA on plant presence/absence data, constrained by
> > > geographical locations. I'd like to constrain the RDA by the "extended
> > > matrix of geographical coordinates" -ie the matrix of geographical
> > > coordinates completed by adding all terms of a cubic trend surface
> > > regression- . 
> > > 
> > > This is the command I use (package vegan):
> > > 
> > >  
> > > 
> > > >rda(Helling ~ x+y+x*y+x^2+y^2+x*y^2+y*x^2+x^3+y^3) 
> > > 
> > >  
> > > 
> > > where Helling is the matrix of Hellinger-transformed presence/absence
> > data
> > > 
> > > The result returned by R is exactly the same as the one given by:
> > > 
> > >  
> > > 
> > > >anova(rda(Helling ~ x+y)
> > > 
> > >  
> > > 
> > > Ie the quadratic and cubic terms are not taken into account
> > > 
> > 
> > You must *I*solate the polynomial terms with function I ("AsIs") so that
> > they are not interpreted as formula operators:
> > 
> > rda(Helling ~ x + y + I(x*y) + I(x^2) + I(y^2) + I(x*y^2) + I(y*x^2) +
> > I(x^3) + I(y^3))
> > 
> > If you don't have the interaction terms, then it is easier and better
> > (numerically) to use poly():
> > 
> > rda(Helling ~ poly(x, 3) + poly(y, 3))
> > 
> > Another issue is that in my opinion using polynomial constraints is an
> > Extremely Bad Idea(TM).
> > 
> > cheers, Jari Oksanen
> > 
> > ----------------------------------------------------------------------
> > LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}
> > 
> > ______________________________________________
> > R-help at 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.
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-help mailing list