## create random data and calculate distances
m <- matrix(runif(20),ncol=2)
d <- dist(m)
## get an order for rows (optimal for the least squares criterion)
o <- seriate(d, method = "MDS")
o
## compare the values for all available criteria
rbind(
unordered = criterion(d),
ordered = criterion(d, o)
)
## compare RGAR by window size (from local to global)
RGAR <- sapply(1:(nrow(m)-1), FUN = function (w)
criterion(d, o, method="RGAR", w = w))
plot(RGAR, type = "b", ylim = c(0,1),
xlab = "Windows size (w)", main = "RGAR by window size")
Run the code above in your browser using DataLab