problem for loop matrix
1 回表示 (過去 30 日間)
古いコメントを表示
this is my code:
n=size(prices,2);
M_coint=zeros(n,n);
for i=1:n;
j=1:n;
tmp=cadf(prices(:,i),prices(:,j),0,1)
M_coint(i,j)=tmp.adf
end
but obtain a nxn matrix in which I have the same value in each row.
I have a matrix, in which in the each columns I have the single stocks, and in the row the time serie price. For example
IBM JPM C
p11 p12 p13
p21 p22 p23
...........
pn1 pn2 pn3
I want obtain a output as a var-cov matrix, but in place of the covariance the score of cointegration test, as the following table.
ibm jpm c
ibm - -3.2 -4.2
jpm -1.2 - -2.1
c -2.3 -4.3 -
I can not generate a code suitable to my needs
0 件のコメント
回答 (1 件)
Thorsten
2015 年 9 月 22 日
I have no experience with the cadf function. But it seems that the value of tmp.adf is not the one you need. Check the cadf function and see how to get the results of a cointegration test. Test it outside a loop for difference prices. The loop itself looks alright to me.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Zernike Polynomials についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!