Estimation optimal lag length VAR model (Matlab version from 2014)
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have the following piece of code which estimates the optimal lag length for a VAR model, with the first part running on matlab versions which already include the estimate and varm functions and the latter part supposed to do the same in older versions. (I have remote access to a computer where the 2014a version is installed without being able to update it.) Currently, the results I am getting with the latter part (running on old Matlab) are very different from those using the newer functions. Is there a better way to produce the same results with the older Matlab version?
[~,d] = version;
for k=1:10
if year(d) >= 2017
Mdl = varm(2,k);
EstMdl = estimate(Mdl,Input);
Results = summarize(EstMdl);
BICtable(k) = Results.BIC;
else
Spec = vgxset('n',2,'nAR',k,'Constant',true);
[EstSpec, EstStdErrors,LLF] = vgxvarx(Spec, Input);
numParam = 2+ k*4;
nObs = size(Input,1);
[~,BICtable(k)] = aicbic(LLF, numParam, nObs);
end
end
[~, In2] = min(BICtable);
OptimLag = In2-1;
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Vector Autoregression Models dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!