[英]Covariance for elements in a matrix - Matlab
I'm struggling here as it's my first attempt with Matlab... 我在这里苦苦挣扎,因为这是我第一次尝试Matlab ...
I have data that looks like this: 我有看起来像这样的数据:
The first row has stockID number and the 60 rows in each column contain the stock's returns. 第一行具有stockID号,每列中的60行包含股票的收益。
I am trying to calculate the variance for each stock as well as a covariance matrix in Matlab. 我正在尝试在Matlab中计算每种股票的方差以及协方差矩阵。 I am stuck because I do not know how to identify each column as its StockID. 我被困住了,因为我不知道如何将每一列标识为其StockID。 Should each column be its own variable? 每个列都应该是其自己的变量吗? If so, how would I do this automatically as I have about 1,000 stocks...? 如果是这样,我将如何自动执行此操作,因为我有大约1,000只股票...? Is there then a way to create a cov. 有没有一种方法来创建一个cov。 matrix for each stock without manually entering in each variable, ie not do this: cov(10801, 12032, 13439, .....) ? 每个股票的矩阵,而无需手动输入每个变量,即不这样做:cov(10801,12032,13439,.....)?
Thanks so much for the help! 非常感谢你的帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.