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

3 次查看(过去 30 天)
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