Efficient construction of a correlation matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg42658] Efficient construction of a correlation matrix
- From: "Mark S. Coleman" <mark at markscoleman.com>
- Date: Sat, 19 Jul 2003 03:19:42 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I'm hoping some of the list experts on mathgroup can suggest an efficient solution to this question. I'm working on a Monte Carlo simulation. Part of the simulation involves construction a correlation matrix for a modest sized data set (the matrix is 7 x 7, each of the 7 lists has only 25 elements). Due to the nature of this problem, I cannot use the built-in CorrelationMatrix[] function. Instead, I must compute each cell of the matrix using the alternative SpearmanRankCorrelation[] function. This function accepts only two lists as inputs, rather than the n x p list accepted by CorrelationMatrix. Thus I need to built a function that will process each of the 7 lists in a pairwise fashion and create the appropriate matrix. Since correlation matrices are upper (lower) triangular, one need only process each pair once, e.g., Corr(i,j) = Corr(j,i). I'd like to find the most efficient way to do this. My solution is clumsy. Thanks, -Mark