Data representation with string header

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

采纳的回答

Adam Danz
Adam Danz 2020-9-7
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 个评论
Adam Danz
Adam Danz 2020-9-7
编辑:Adam Danz 2020-9-7
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 2020-9-8
thanks Adam for the reply. Appreiat the time :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by