[R-sig-eco] vegan rda

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed Sep 28 09:26:11 CEST 2011


On Wed, 2011-09-28 at 00:49 +0200, Sibylle Stöckli wrote:
> Dear Jari,
> 
> Thanks a lot for your very helpful comments. I still believe that my  
> results are wrong using the 'standard' RDA code.
> 
> Using the following code, I receive 'points' for the Y matrix (height)  
> and arrows for the X matrix (species) (see pdf). It should be the  
> opposite way (as seen in the R help varespec example) so I think my  
> RDA model is not yet adequate. If you look at the R help varespec  
> file, you see that the 'dependent' values are placed below each species.

That **is** what you asked for. Note that **you** specified `height` as
response and `., data = species` for the constraints (the independent
variables or explanatory variables).

Some object to the way vegan displays biplots/triplots for RDA. One
could argue that both the species (or response variable, height in your
case) scores and the constraints (explanatory variables, the species in
your case) should both be represented by biplot arrows.

Vegan doesn't do this; it draws the species (response) scores as points;
these points are where the arrow head would be if we *had* drawn them as
arrows. Only the constraints are represented as arrows in vegan PCA/RDA
biplot/triplots.

I honestly couldn't follow your line of argument in your original post
to the list. If you want (your object) `species` as the response and
(your object) `height` as the constraints or explanatory variables, then

ME_rda <- rda(species ~ ., height, scale = TRUE)

> I  attached the txt file maybe it is easier to understand my problem:  
> My dependent values are placed each in a separate variable, and below  
> the species variables the identity is given (e.g. two species plot 2  
> species have the values 0.5 and 0.5, and all the others are zero).
> I tried as.factor for species, but I it does not look fine
> As mentioned I tried to place the tree height values below each  
> species, but there are a lot of NA values (e.g. in a two species plot  
> I just have two species and all teh others are NA). In the varespec  
> file such values would be zero (as they are not present in that plot).
> The 'varechem' file is similar to my matrix. They are just the env  
> variables (not yet included) giving arrows, which is perfect.

Your file did not make it through the mail filters. Plain text should
get through, so supply as CSV or similar if you need us to take a look.

However, It isn't too helpful to keep on telling us how your data are
formatted in whatever programme you entered the data in. R most easily
works with data in simple spreadsheet-style formats. If you have your
variables in columns, samples in rows, you won't go wrong. The file can
contain both the response and explanatory variables or you can two
separate files for response and explanatory variables.

HTH

G

> Thank a lot to the R community!
> Sibylle
> 
> R example
> data(varespec)
> data(varechem)
> ## Common but bad way: use all variables you happen to have in your
> ## environmental data matrix
> vare.cca <- cca(varespec, varechem)
> vare.cca
> plot(vare.cca)
> 
> 
> 
> 
> 
> 
> My code
> ME<-read.table("ME_rda.txt", na.strings="*", header=TRUE)
> 
> height<-ME[,3:6]
> mortality<-ME[,7:9]
> species<-ME[,11:16]
> env<-ME[,10:33]
> 
> library(vegan)
> ME_rda<-rda(height~.,species, scale=TRUE)
> ME_rda
> plot(ME_rda, scaling=-1)
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 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-sig-ecology mailing list