Skip to content

Randomizing matrices

1 message · Peter Solymos

#
Allan, here is a toy example. Cc-ing back to SIG-ECO:

library(fields)
library(vegan)
x <- matrix(1:12,3,4)
rf <- function(x)
    array(sample(x), dim=dim(x))
sf <- function(x, y) {
    d <- rdist(x, y)
    sum(d %*% d)
}
z <- oecosimu(x, sf, rf)
z
hist(c(z$statistic, z$oecosimu$simulated))
abline(v=z$statistic, col=2)

Peter

--
P?ter S?lymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
solymos at ualberta.ca, Ph 780.492.8534, http://psolymos.github.com
Alberta Biodiversity Monitoring Institute, http://www.abmi.ca
Boreal Avian Modelling Project, http://www.borealbirds.ca
On Sun, Aug 19, 2012 at 5:50 AM, Allan Edelsparre <aedelspa at uoguelph.ca> wrote: