How to find 2d spearman and kendall correlations using corr2?
2 ビュー (過去 30 日間)
古いコメントを表示
I've been using corr2 to find correlation between two arrays. It calculates Pearson correlation.
I was hoping to repeat the code using Spearman or Kendall. Documentation doesn't mention the option to change type, but I tried anyway. Error says there are too many inputs.
A=[ 3 4 3; 0 3 0; 1 5 7];
B=[ 3 4 3; 0 3 0; 1 5 7];
C=corr2(A,B, 'Type', 'Kendall' );
Error using corr2>ParseInputs (line 30)
Too many input arguments.
Error in corr2 (line 21)
[a,b] = ParseInputs(varargin{:});
C=corr2(A,B) works just fine.
Does anyone know if it's possible to find Spearman or Kendall 2d correlation using corr2? If not, any suggestions?
0 件のコメント
採用された回答
Jeff Miller
2020 年 6 月 4 日
corr2 is doing the same computation as corr, except that it allows 2d inputs rather than 1d. So, you can get your Spearman or Kendall correlation using corr with the 'type' option, but pretending you have 1d rather than 2d inputs, e.g.
spear = corr(A(:),B(:),'type','Spearman')
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!