Borrar filtros
Borrar filtros

How to loop the number of lags in a VAR?

7 visualizaciones (últimos 30 días)
Armando MAROZZI
Armando MAROZZI el 13 de Mayo de 2020
Editada: Armando MAROZZI el 13 de Mayo de 2020
I am fitting a simple var model. What I would like to do is basically choosing the optimal number of lags. I can do it in two ways: Likelihood test or AIC criteria. In either cases, I need to compute as many VAR as the number of lags p. I would like to avoid doing it one by one. I'd rather write a loop but I am failing at it.
This is an example:
% this is one VAR
dataset = rand(100,4)
model = varm(4, 2);
model.SeriesNames = {'I', 'U', 'O', 'W'};
model = estimate(model, dataset);
results = summarize(model)
% I tried this and variations of this but it doesn't work
for j = 2:10
model = varm(4, j);
model = estimate(model, DATASETC.SERIES(:,2:5));
results = summarize(model);
end
% I would like to have all the models stored in 'model' and 'results'
Is there anyone who can help me with this?

Respuestas (0)

Categorías

Más información sobre Vector Autoregression Models en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by