How to create a loop that creates a set of ARIMA models and estimates the models to give LogL results
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi there,
I have manually created 16 arima models and have estimated them to produce LogL results in order for me to select the most appropriate model for my data.
See below for how I have manually created them.
mdl20=arima(1,0,1);
mdl21=arima(1,0,2);
mdl22=arima(1,0,3);
mdl23=arima(1,0,4);
% all the way to
mdl32=arima(4,0,1);
mdl33=arima(4,0,2);
mdl34=arima(4,0,3);
mdl35=arima(4,0,4);
then I have used this function to estimate them using my dataset L_Ret:
[EstMdl20,~,logL20] = estimate(Mdl20,L_Ret);
[EstMdl21,~,logL21] = estimate(Mdl21,L_Ret);
[EstMdl22,~,logL22] = estimate(Mdl22,L_Ret);
[EstMdl23,~,logL23] = estimate(Mdl23,L_Ret);
% all the way to
[EstMdl32,~,logL32] = estimate(Mdl32,L_Ret);
[EstMdl33,~,logL33] = estimate(Mdl33,L_Ret);
[EstMdl34,~,logL34] = estimate(Mdl34,L_Ret);
[EstMdl35,~,logL35] = estimate(Mdl35,L_Ret);
Any help will be immensly appreciated
1 Commento
Kevin Chng
il 1 Ago 2018
Hi,
I'm interested to know how you compare the model. AIC&BIC? or Residual?RMSE?
Regards, Kevin Chng
Risposte (1)
Prajit T R
il 25 Giu 2018
Hi Harry
A good programming approach would be to use an array to store the corresponding values in a specific index position instead of declaring a new variable each time.
However, in this case the variable is of ARIMA type, which can not be stored in arrays. You can make a class to hold these ARIMA type variables, and create an array of objects of the class to simplify your job.
However, in your case you just want to see which model suits your workflow. You can follow this crude method to obtain the model estimates:
for i=1:4
for j=1:4
disp('Estimate for values:')
%Print i and j so that you can see which model is being processed
i
j
Mdl=arima(i,0,j)
[EstMdl,~,logL] = estimate(Mdl,L_Ret)
end
end
In each iteration, the values of EstMdl and logL will be printed and you can see which estimate suits you. Note that this after each iteration, the previous value of EstMdl and logL would be replaced. This is not an elegant solution, but in your case with just 16 models, this should be helpful.
Cheers
Prajit
Vedere anche
Categorie
Scopri di più su Conditional Mean Models in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!