Find Which rows/items have a positive correlation with another item

조회 수: 3 (최근 30일)
Learning
Learning 2022년 8월 22일
편집: Torsten 2022년 8월 23일
Hi,
I have a dataset (see below, rows 2 to 6, items A to E). I want to find out which items have a positive correlation with row 3 (item B). The data for each item is contained in columns B to E. Time course for when a measurement was performed is contained in the first row. As you can see, for item B, at 0hrs, it is 0 but them it increases linearly as time goes on. I want to find other items that have this behaviour as item B increases with time.
Any idea on how to use Matlab code to find out which set of items have a positive correlation with item B with time?
Thank you.

답변 (1개)

Torsten
Torsten 2022년 8월 22일
편집: Torsten 2022년 8월 23일
format long
A = [1 2 0 4;0 2 3 4;0 1 2 3;1 3 4 2;0 0.5 1 1.5].';
R = corrcoef(A)
R = 5×5
1.000000000000000 0.485714285714286 0.529150262212918 -0.377964473009227 0.529150262212918 0.485714285714286 1.000000000000000 0.982707629823991 0.529150262212918 0.982707629823991 0.529150262212918 0.982707629823991 1.000000000000000 0.400000000000000 1.000000000000000 -0.377964473009227 0.529150262212918 0.400000000000000 1.000000000000000 0.400000000000000 0.529150262212918 0.982707629823991 1.000000000000000 0.400000000000000 1.000000000000000
  댓글 수: 3
Learning
Learning 2022년 8월 22일
I want to compare items A, C, D, and E to that of B and determine which of them has the best positive correlation to item B.
Torsten
Torsten 2022년 8월 23일
편집: Torsten 2022년 8월 23일
As you can see from the second column, the correlation between B and C and B and E is greatest (and equal).

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

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by