Reputation: 10934
I have a 2 vectors of numbers of either 1 or -1. What are the standard tools on Matlab that would help me calculate a correlation number between the two vectors? Thanks in advance!
Upvotes: 4
Views: 4029
Reputation: 31
The corr function in matlab would switch to Phi-coefficient if it sees binary data.
Upvotes: 3
Reputation: 125854
The CORRCOEF function is what you're looking for:
R = corrcoef(vector1(:),vector2(:)); %# Returns a 2-by-2 matrix of
%# correlation coefficients
If you have the Statistics Toolbox, you may also want to check out the function CORR:
RHO = corr(vector1(:),vector2(:)); %# Returns the linear correlation coefficient
%# (default is a Pearson correlation)
Upvotes: 2