Store results of ADF stationarity test (for all columns) in a table
2 ビュー (過去 30 日間)
古いコメントを表示
I have a (324 x 9) matrix of dataset known as "compare_mat". I am trying to store the results of the ADF test of stationarity in a table. I have performed the test for all 9 columns via a for loop using the procedure mentioned here: https://www.mathworks.com/matlabcentral/answers/463555-test-results-in-a-table
Here's my code:
% ADF test to check for stationarity: STRANGE RESULTS!
stat_adf = zeros(size(compare_mat,2),3);
for i = 1: size(compare_mat,2)
[h,pValue,stat] = adftest(compare_mat(:,i));
stat_adf(i,:) = adftest(compare_mat(:,i));
end
ADF_Test = array2table(stat_adf,...
'VariableNames',{'Null_rejected','pValue','Test_Statistic'},...
'RowNames',{'10y','3mo-10y','2*2y-10y-3mo', 'beta 1', 'beta 2', 'beta 3',...
'PC 1', 'PC 2', 'PC 3'})
While it works, the results of columns depicting p-value and stat appear strange. They appear to be logical numbers or dummy variables (0 or 1), when instead they should be rational numbers (i.e. decimal numbers). This is because when i individually performed the ADF test for each column separately, the results were not 0 or 1 for the second and third columns. Here is a screenshot of my results. It is the table "ADF_test".
What should I change in the code to get the correct results? Thanks in advance for your help.
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!