[R] randomisation

francoisromain@free.fr francoisromain at free.fr
Wed Feb 9 15:05:39 CET 2005


Selon Yann Clough <y.clough at NS1.uaoe.gwdg.de>:

> Dear useRs
>
> I am looking for a way to randomise the values within a matrix:
> the conditions are that the sums of the rows and the sums of the columns
> should
> remain the same as in the original matrix.
>
> Any help would be appreciated
> Cheers
>
> Yann
>
> ______________________________________________
> 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
>


Hello, your question makes me think about what does the chisq.test function with
simulate.p.value = T, maybe that could help to look what is done there.

The help page of chisq.test points to that reference wich seems quite like what
you are looking for :

Patefield, W. M. (1981) Algorithm AS159. An efficient method of generating r x c
tables with given row and column totals. Applied Statistics 30, 91-97.


Romain.




More information about the R-help mailing list