[R] randomisation

Peter Rabinovitch peter.rabinovitch at alcatel.com
Wed Feb 9 14:43:21 CET 2005


This is not trivial. There is a really nice algorithm (should be simple to
code up) due to Persi Diaconis, and described in example 1.22 (page 1-14) of
Joseph Chang's notes on Markov chains available at
http://www.stat.yale.edu/~jtc5/251/mc.pdf




-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Yann Clough
Sent: Wednesday, February 09, 2005 8:28 AM
To: Peter Dalgaard; r-help at stat.math.ethz.ch
Subject: Re: [R] randomisation


   I  am working on an ecological problem and dealing with a matrix where
   rows correspond to samples, and columns correspond to species.

   The values in the matrix are recorded abundances of the organisms.

   I  want  to  create  a  series  of  randomised  datasets  where  total
   abundances per sample (rowSums) and per species (colSums) are equal to
   those in the dataset of my observations.

   Simple example of the kind of thing I have:

   matrix(c(1,0,2,10,1,3,5,6,7,1,0,0),nrow=4,  ncol=3,by=row)  # observed
   data

   rowSums(tempmatrix) #individuals per location,

   colSums(tempmatrix) #individuals per species

   example of a matrix which complies with the two restrictions:

   tempmatrix2=matrix(c(1,0,2,11,0,3,5,6,7,0,1,0),nrow=4, ncol=3,by=row)

   rowSums(tempmatrix2)

   colSums(tempmatrix2)

   hope this is clear

   Cheers

   Yann

   ***************************

   Yann Clough

   Fachgebiet Agraroekologie

   Waldweg 26

   D-37073 Goettingen

   Tel: 0551/39-2157

   email: y.clough at uaoe.gwdg.de

   www: http://wwwuser.gwdg.de/~uaoe/mitarbeiter/y_clough.htm
______________________________________________
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




More information about the R-help mailing list