Is there a way to detect the autocorrelation in a loop?

3 次查看(过去 30 天)
I'm going to perform a little more than 19,000,000 regressions in a loop (and grow a beard), but i need to now if I can detect the auto correlation on these regressions. I am going to have 90 X's and 75 Y's : each of these x's will be stored in a ''pool'' and i will make all combination of 4 x possible (via nchoosek(90,4) ). But It might happen that my Y will also be a X and if so i don't want it to be tested. OR per exemple if one of my X is the Dow and the Y is the SPX it won't be the same but will contain auto correlation. Any ideas?
  2 个评论
Leah
Leah 2013-6-4
So are you just going to do a Durbin-Watson test inside the loop?
Simon
Simon 2013-6-5
Altough it seems that i get autocorrelation in EVERY test I do according to dwtest. I use this code :
if true
% code
end%%
%%R^2 adjusted
for i = 1:B
REG = LinearModel.fit(F{1,i});
C{1,i}(1,1) = REG.Rsquared.Adjusted;%%For further analysis
P{1,i} = REG.Residuals.Raw; %%My residuals for dwtest, each cell contains 524x4 residuals
G{1,i} = REG.Coefficients; %%For further analysis
end
end
%%Dwtest
for i = 1:B
N{1,i} = dwtest(P{1,i},15);
if N{1,i} == 0
N{1,i} = [];
end
end

请先登录,再进行评论。

采纳的回答

Simon
Simon 2013-6-6
Bump

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by