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!
The corr function in matlab would switch to Phi-coefficient if it sees binary data.
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)
精彩评论