I have a list of records with fields that can be seen as two sets of variables: dependent and independent. There are say 100 fields in each record and we consider 10 of them as dependent variables and 90 as independent.

What are the methods to find all the correlations that exist between the two sets?

(At introductory statistics course that I've taken we have been dealing with simple correlations between two variables but the task like this was not covered.)

  • $\begingroup$ What is the concept you have in mind for correlation between two sets? There are concepts such as testing equality of covariance matrices if the two sets had the same dimension and represented the same variables. You can always calculate individual pairs for correlation also. But it sounds like you have in mind some other kind of relationship which may not exist in the statistics literature. $\endgroup$ – Michael R. Chernick Sep 18 '12 at 15:31

I agree with Guillaume that a CCA could be useful. CCA is symmetric in the X and Y variables - so neither is presumed to be the cause of the other. If you truly believe that the "ten" are dependent on the "90", you could do a MANOVA. It's in R.

The MANOVA uses a principal components analysis to find the linear combination of the dependent variables, that is best explained by the independent variables.

  • $\begingroup$ Re:MANOVA, I was thinking two separate PCAs (one for the 90, another for the 10) could be helpful; for example, a simple correlation on the PC1s could give a sense. Perhaps another question, but would there be a relationship between this and MANOVA? $\endgroup$ – Max Ghenis Sep 2 '15 at 5:41

First of all: what statistical package are you using? Secondly, I'm not sure I understand your question?

The way I understand it, you want to find the correlations on the set $\{I_1,I_2 ... I_{90}\} \times \{D_1, D_2...D_{10}\}$. In Stata, this can be accomplished by the commandos

corr i1 d1 d2...d90
corr i10 d1 d2...d90

I hope this goes somewhere in answering your question.


If you are talking about getting the $90 \times 10 = 900$ correlation coefficients between what you call the dependent and independent variables, this is only a matter of using a statistical software.

If you are using R, it would be like this

# Suppose X is a nx90 matrix with independent variables
# and that Y is a nx10 matrix with the dependent variables.
cor(X, Y)

The command cor(X,Y) gives a $90 \times 10$ matrix with the coefficients you are looking for. Below I give an example with fake data but real matrices so that you can check what the output looks like.

# Say n = 1000.
X <- matrix(rnorm(90*1000), ncol=90)
Y <- matrix(rnorm(10*1000), ncol=10)

But honestly, 900 coefficients of correlation will not lead you very far without further analysis. Perhaps you are actually searching for the linear combination of X that best correlates with a linear combination of Y, or trying to fit a 10-dimensional multivariate response on 90 predictors?

Intuitively, I'd say you are actually aiming for a canonical correlation analysis, of which you can find a primer on Jeromy Anglim's blog. In R it looks like this.

cca <- cancor(X,Y)
# Highest correlation between pairs of linear combinations
# Corresponding linear combination in X (90 coefficients)
# Corresponding linear combination in Y (10 coefficients)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.