[S] necessary loop ?

Douglas Steele (Douglas@dsteele.demon.co.uk)
Sat, 12 Sep 1998 14:33:32 +0100


I am wanting to calculate the permutation distribution of the canonical
correlation between two pairs of variables. (Data stored as array,
first two columns being correlated with second two columns. The rows of
the first two columns being permutated to maintain the covariance's.)

I can't see any way to avoid the loop. Can anyone suggest an
alternative ?

x <- 1:length(data[,1])
for(i in 1:5000) z[i] <- cancor(data[sample(x),1:2],data[x,3:4])$cor[1]

Douglas Steele
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news