Data representation with string header

9 views (last 30 days)
Hello,
I have a timetable and I want to know the correlation between diffrent variables in an organized way. For example, I have the closing price of Microsoft , Apple , Wallmart, and Cake. how can I join them and create a coverience matrix with their names on top and left of the matrix?

Accepted Answer

Adam Danz
Adam Danz on 7 Sep 2020
If you have the Econometrics Toolbox you can use corrplot() to show a grid of correlations between all pairs of columns in your table - you can remove the columns that should be ignored.
If you don't have access to that function, you can use plotmatrix() and then add in the correlation values to make it look a lot like the corrplot by following this demo.
  5 Comments
Adam Danz
Adam Danz on 7 Sep 2020
Edited: Adam Danz on 7 Sep 2020
You've got two options.
1) corrplot can receive a table as an input and it will use the var names from the table. You'll have to convert yoru timetable to a table using timetable2table and then isolate the desired columns so the output is still a table using indexing T(:,[2,3]), for example.
2) Use the matrix input that you're already using and specify the var names using the 'varNames' property which you could either manually enter or pull from the timetable using T.Properties.VariableNames where T is your timetable or table.
Important note: var1 and var3 clearly do no obey the linearity assumption so their correlation values are meaningless. The other pairs of variables do not obey the normality assumption nor do they appear to be on a continuous scale. I don't see a single scatter plot that looks like it would produce a meaningful correlation value.
Maha Almubarak
Maha Almubarak on 8 Sep 2020
thanks Adam for the reply. Appreiat the time :)

Sign in to comment.

More Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!