フィルターのクリア

Why is the result matrix “rho” of function corr (A, B) not a symmetric matrix?

3 ビュー (過去 30 日間)
Sure
Sure 2023 年 12 月 4 日
コメント済み: Sure 2023 年 12 月 5 日
When I was browsing the ‘corr’ function examples provided on the official website, I found that the matrix rho in the result of corr (A, B) is not a symmetric matrix. This contradicts the mathematical knowledge I have learned, and I cannot understand why. Can someone help me? I would greatly appreciate it. The link is Linear or rank correlation - MATLAB corr (mathworks.com)

採用された回答

Bruno Luong
Bruno Luong 2023 年 12 月 4 日
As the doc describe, for example
  • rho(2,1) is the correlation between X(:,2) and Y(:,1)
  • rho(1,2) is the correlation between X(:,1) and Y(:,2)
There is no reason why rho(2,1) must be equal to rho(1,2), as they involve two DIFFERENT pairs.

その他の回答 (1 件)

Torsten
Torsten 2023 年 12 月 4 日
移動済み: Torsten 2023 年 12 月 4 日
corr(X,X) is symmetric, but why should corr(X,Y) be symmetric ? Element (i,j) is the correlation of column i of X and column j of Y, while element (j,i) is the correlation of column j of X and column i of Y.
  1 件のコメント
Steven Lord
Steven Lord 2023 年 12 月 4 日
Instead of corr(X, X) you should probably just call corr(X). As stated on the documentation page for the corr function, "If you input only a matrix X, rho is a symmetric k-by-k matrix, where k is the number of columns in X. The entry rho(a,b) is the pairwise linear correlation coefficient between column a and column b in X."
The corresponding sentence for the two-input case does not include the word "symmetric".

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by