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

3 visualizaciones (últimos 30 días)
Simon
Simon el 4 de Jun. de 2013
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 comentarios
Leah
Leah el 4 de Jun. de 2013
So are you just going to do a Durbin-Watson test inside the loop?
Simon
Simon el 5 de Jun. de 2013
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

Iniciar sesión para comentar.

Respuesta aceptada

Simon
Simon el 6 de Jun. de 2013
Bump

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by