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

3 views (last 30 days)
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.

Answers (1)

Torsten
Torsten on 22 Aug 2022
Edited: Torsten on 23 Aug 2022
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 Comments
Learning
Learning on 22 Aug 2022
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 on 23 Aug 2022
Edited: Torsten on 23 Aug 2022
As you can see from the second column, the correlation between B and C and B and E is greatest (and equal).

Sign in to comment.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!