swap.m (Scripts) Publisher's description
from Brice Semmens
This function carries out a swap algorithm as described in Stone and Roberts (1990)
This function carries out a swap algorithm as described in Stone and Roberts (1990), Oecologia 85:74-79. The data matrix must be organized with sites (islands) as rows, and species as columns. The function only works with binary matrices (but can be easily modified to convert abundance matrices).
"Swapping" randomly shuffles a binary matrix while keeping the row and column sums the same.
To call the function, send the data matrix and the number of swaps you wish to have carried out: swap(matrix,1000). The function returns the shuffled matrix. For each swap, the function randomly identifies two rows and columns such that:
and then switches (swaps) the 0's and 1's within the columns.
Written by Brice X. Semmens (email@example.com), 03/26/03
Comments and modifications/improvements welcome.
System Requirements:MATLAB 5.3.1 (R11.1)
Program Release Status: New Release
Program Install Support: Install and Uninstall