This is follow-up from a previous question: How to separate groups using PCA?.

I have $25$ normals and $12$ patients. For each of them I have a vector representing a spectrogram (length $2000$).

So I have a matrix $Z$ of size $[25\times2000;12\times 2000]$.

I calculate:

[coeffZ, score, latent, tsquared, explained, mu]=pca(Z);

and bar(explained) shows me that the first $3$ PCs explain most of the variance.

I also have a behavioral score (from testing) for each of the subjects ($[37\times 1]$). It was suggested that I see if the first 3 PCs can predict the behavioral score using multiple correlation coefficient. Specifically this: http://en.wikipedia.org/wiki/Multiple_correlation

Does this make sense? Does anybody have an idea of how I can implement this in Matlab?

  • 1
    $\begingroup$ What was the previous question. I don't understand this one. $\endgroup$ Commented Mar 6, 2014 at 21:00
  • $\begingroup$ @susan First: please add the link to your previous question. Second: this question is almost off-topic here, because you ask how to do something in a particular programming language (MATLAB). Please think how you can revise your question to make it more general and extend beyond a simple programming question. $\endgroup$
    – amoeba
    Commented Mar 6, 2014 at 22:49
  • $\begingroup$ Not sure but is it the same as regress? mathworks.com/help/stats/regress.html?searchHighlight=regress $\endgroup$
    – susan
    Commented Mar 7, 2014 at 14:13
  • $\begingroup$ I think it is this: mathworks.com/help/stats/… but I do not have the statistics toolbox $\endgroup$
    – susan
    Commented Mar 7, 2014 at 14:18
  • $\begingroup$ @susan: If you want somebody to receive your comments automatically, you should include @ username (without a space) somewhere in the comment. I noticed your comments only by chance (opened this question to check if there are new comments...). I can update my answer to address your your comments, but how did you run pca() if you don't have statistics toolbox? $\endgroup$
    – amoeba
    Commented Mar 7, 2014 at 16:19

1 Answer 1


Even though the question as it stands now is arguably off-topic, I will provide a quick answer.

There is no function in MATLAB to directly compute multiple correlation coefficient. In principle, you could either use multiple regression function regress() to get $R^2$ and obtain your correlation coefficient $R$ with a square root, or canonical correlation function canoncorr(), which reduces to multiple correlation if one of the datasets consists of only single variable.

However, in your particular case three PCs are uncorrelated (it is a property of PCA), so square of the multiple correlation of your behavioural score with the three PCs is simply equal to the sum of squares of usual correlations between the behavioural score and each of the three PCs. So you can compute these three correlation coefficients, square them, add them up, take the square root, and you are done.

  • $\begingroup$ Yes, if I understand you correctly I just need to do sqrt[corr(score(:,1),beh)^2 + corr(score(:,2),beh)^2 + corr(score(:,3),beh)^2] $\endgroup$
    – susan
    Commented Mar 7, 2014 at 17:11
  • $\begingroup$ just making sure you see this: Yes, if I understand you correctly I just need to do sqrt[corr(score(:,1),beh)^2 + corr(score(:,2),beh)^2 + corr(score(:,3),beh)^2] $\endgroup$
    – susan
    Commented Mar 7, 2014 at 17:12
  • $\begingroup$ @susan: If you comment on my answer, then I will receive notifications in any case :) Yes, the formula is correct. $\endgroup$
    – amoeba
    Commented Mar 7, 2014 at 17:15
  • $\begingroup$ Do you have an idea of how to test the significance of the obtained R.I tried F ratio mentioned here - utdallas.edu/~herve/Abdi-MCC2007-pretty.pdf but they don't explain what the numbers mean :) i.e. what does an F ratio of 10.22 mean? $\endgroup$
    – susan
    Commented Mar 8, 2014 at 1:11
  • $\begingroup$ @susan: It's the value of F statistic, and it can be converted into a p-value. So if your F=10.22 and number of degrees of freedom is J=3 and N-J-1=37-3-1=33 (see the pdf you found), then you can calculate (e.g. here graphpad.com/quickcalcs/PValue1.cfm) that p<0.0001, i.e. highly significant. $\endgroup$
    – amoeba
    Commented Mar 8, 2014 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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