null models with continuous abundance data
Hi Etienne, the double constraint is observed by two functions: swap.web in package bipartite and commsimulator in vegan (at least in the r-forge version) Both build on the r2dtable approach, i.e. you have, as you propose, to turn the low values into higher-value integers. The algorithm is described in the help to swap.web. HTH, Carsten
On 06/01/2010 08:55, Etienne Lalibert? wrote:
Hi,
Let's say I have measured plant biomass for a total of 5 species from 3
sites (i.e. plots), such that I end with the following data matrix
mat<- matrix(c(0.35, 0.12, 0.61, 0, 0, 0.28, 0, 0.42, 0.31, 0.19, 0.82,
0, 0, 0, 0.25), 3, 5, byrow = T)
dimnames(mat)<- list(c("site1", "site2", "site3"), c("sp1", "sp2",
"sp3", "sp4", "sp5"))
Data is therefore continuous. I want to generate n random community
matrices which both respect the following constraints:
1) row and column totals are kept constant, such that "productivity" of
each site is maintained, and that rare species at a "regional" level
stay rare (and vice-versa).
2) number of species in each plot is kept constant, i.e. each row
maintains the same number of zeros, though these zeros should not stay
fixed.
To deal with continuous data, my initial idea was to transform the
continuous data in mat to integer data by
mat2<- floor(mat * 100 / min(mat[mat> 0]) )
where multiplying by 100 is only used to reduce the effect of rounding
to nearest integer (a bit arbitrary). In a way, shuffling mat could now
be seen as re-allocating "units of biomass" randomly to plots. However,
doing so results in a matrix with large number of "individuals" to
reshuffle, which can slow things down quite a bit. But this is only part
of the problem.
My main problem has been to find an algorithm that can actually respect
constraints 1 and 2. Despite trying various R functions (r2dtable,
permatfull, etc), I have not yet been able to find one that can do
this.
I've had some kind help from Peter Solymos who suggested that I try the
aylmer package, and it's *almost* what I need, but the problem is that
their algorithm does not allow for the zeros to move within the matrix;
they stay fixed. I want the number of zeros to stay constant within each
row, but I want them to move freely betweem columns.
Any help would be very much appreciated.
Thanks
Dr. Carsten F. Dormann Department of Computational Landscape Ecology Helmholtz Centre for Environmental Research-UFZ Permoserstr. 15 04318 Leipzig Germany Tel: ++49(0)341 2351946 Fax: ++49(0)341 2351939 Email: carsten.dormann at ufz.de internet: http://www.ufz.de/index.php?de=4205