필터 지우기
필터 지우기

Using "Pearson correlation coefficient" in the 'Pdist' for the Clustergram function

조회 수: 18 (최근 30일)
I am doing the Hierarchical cluster analysis. I constructed the dendrograms by the 'clustergram' using agglomerative average-linkage clustering. But I need to use 'pearson correlation coeffiecient' for the distance matric(the default distance matric is euclidean, there are other matric availdable as well), but I could not find the pearson correlation available in the 'PDist' function. Thanks for helping.

채택된 답변

Scott Ronquist
Scott Ronquist 2020년 11월 2일
The 'correlation' option for pdist uses the pearson correlation (documentation page here). So to use this metric to calculate the distance between columns in clustergram, you can call:
clustergram(..., "ColumnPDist", "correlation")
The same option is available for "RowPDist" as well.
  댓글 수: 5
Scott Ronquist
Scott Ronquist 2020년 11월 3일
The apostrophe is used to transpose the matrix X.
corr calculates the correlation between the columns of the input matrix. pdist calculates the distance between the rows of the input matrix. The apostrophe operator computes the complex conjugate transpose of X. When the values of X are all real numbers (as is the case here), this is the same as the basic transpose function.
X' can be replaced with transpose(X) in the code from above:
X = rand(5,2);
pdist(transpose(X), "correlation")
1-corr(X)
Wen Yang
Wen Yang 2020년 11월 3일
The penny dropped. Thank you so much Ronquist for your help, patient and hardworking.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Expression Analysis에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by