Pearson Correlation without using zero element in Matlab
问题 I have 2 example vector in Matlab : A = [5,3,3,0,4,1,5,0,2,5,5,0,5,3,4,0,1,4,4,0,4,2]; B = [1,0,0,0,1,0,4,0,0,0,0,4,4,0,1,0,0,0,0,0,0,0]; When, I try to calculate pearson correlation with manual method and do it with excel I have the same result ( 0.667 ) 1 0,667 0,667 1 But when I tried in MatLab with simple code: pearson = corr(A',B'); it return the result with different score ( 0,2139 ). 1 0,2139 0,2139 1 Maybe Its happen because the zero score(0) is using to calculate it. In happen