[R] RDA and trend surface regression

Jari Oksanen jarioksa at sun3.oulu.fi
Tue Feb 27 08:27:08 CET 2007


> '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



More information about the R-help mailing list