[R-sig-eco] vegan rda

Jari Oksanen jari.oksanen at oulu.fi
Tue Sep 27 23:25:36 CEST 2011


Sibylle,

I noticed that you also sent this message to the main R-news mailing list,
but may not have received any answers. I'm not sure that I can answer to
your questions either, since I don't quite follow your explanation. So here
comes a rambling in a parallel universe in hope we go on with similar lines,
and you find some relief in this message.

1) The rda() cals should be of this form

rda(Y ~ X1 + X2 + ... Xn, data = DF, na.action = na.exclude)

where Y are the dependent data (matrix, data frame or a single variable),
and X1, X2, ..., Xn are the independent data. The independent data can be
variables or matrices (but not data frame). Argument 'data' gives the name
of the data frame (here DF) where the dependent variables are searched
first, and if they are not found there, they are searched in the main
working environment. Finally, na.action tells you how to handle missing
values in dependent data. The default was na.fail (like you were informed in
the output), but you can also have na.exclude or na.omit (see the
documentation). Can you put your problem in this form?

2) About "missing" species. If a species is missing, it is *certainly* 0.
Missing *value* (NA) means that you do not know the abundance of the
species, or you do not know the presence of the species. For presence, it
could be anything between 0 and 1. In your case it certainly is 0.

3) Missing data are not allowed in dependent variable in vegan rda().

4) You cannot reverse the left and right hand sides in the rda() formula.
The method is non-symmetric: you have dependent variable(s) (left-hand side)
and you have independent variable(s) (right-hand side). Function rda() is
very much like linear regression: you cannot swap dependent and independent
variables.

Can you go on with these guidelines?

Cheers, Jari Oksanen

First about defining an rda() model.
On 22/09/11 22:03 PM, "Sibylle Stöckli" <sibylle.stoeckli at gmx.ch> wrote:

> Dear R users
> 
> I am calculating a RDA for a dependent matrix (different variables for
> tree performance) and different explanatory variables (species
> identitiy, diversity, soil data, ground vegetation). I would very much
> appreciate some help with my txt input file for the vegan function.
> 
> As for standard RDA's I have different plots (lines, the dependent
> matrix) and for each plot a value for diversity, soil and vegetation
> (in columns, the environmental matrix). I additionally have different
> species for each plot (separated in columns). In standard RDA's for
> vegetational data you put your dependent variable (e.g. number of a
> specific species in the specific plot) below your species columns.
> Problem: I do not have vegetational data with values 0, 1,2, 3 for
> each plot and species. I have 6 species in total, but the plots have a
> predetermined diversity level (e.g. 1, 2, 4, 6). So in comparison to
> vegetational data I do not have '0' values. For example in my 4
> species plot I have 4 species and two missing (NA) values. I have read
> some papers using the same analysis for biodiversity experiments, so
> it should be appropriate. So I decided to put the dependent variables
> separately in different variables and to give species values as the
> proportion within the plot (2-species plot: 0.5+0.5, 1-species plot:
> 1.0).
> 
> My txt file looks like
> 
> tree height - crown PA - tree biomass (all dependent variables) -
> Diversity - Species A - Species B - Species C - Species D - Soil -
> Vegetation
> 10                     20
> 15 
>                                                                             2
>               0                      0.5
> 0.5            0                    16        25
> 20                      56
> 36 
>                                                                           1
>               1                      0
> 0              0                   22        45
> 
> 
> So I changed the code for rda (dependent variable on the right of the
> tilde and the explanatory variable on the left of the tilde). In
> standad RDA the dependent variable would be on the left. I tried this,
> but then I was getting points for the dependent variables and not
> arrows. it is because RDA tried to do an RDA on the dfferent species
> (but there is no dependent variable, but just die identity). However,
> I get some error message changing the R-code: Error in
> model.frame.default(formula, data, na.action = na.fail, xlev = xlev) :
>    invalid type (list) for variable 'height'. And a second problem is
> that I wanted to include the other environmental matrix (env). I tried
> to include the second matrix on the right of the tilde, but rda was
> producing an error.
> 
> A last question: Some rare NA values within my env matrix. na.rm=TRUE
> does not seem to work with rda. Does anyone know how to work with NA
> values and RDA (according to the list it seems a bit more complex, but
> maybe in the meanwhile there is a better solution).
> 
> Many thanks for any hint or comments
> Sibylle
> 
> 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(species~height, scale=TRUE)
> ME_rda
> plot(ME_rda, scaling=-1)
> 
> 
> [[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



More information about the R-sig-ecology mailing list