Hi, I'm trying to create an auto regressive model, and I want to use AIC to identify the optimal number of lags to include in it. Does anyone know of any code that I can use to do this? I think this requires the econometrics toolbox which I do have. Thanks

 채택된 답변

Oleg Komarov
Oleg Komarov 2011년 7월 31일

1 개 추천

Example: AR(1)
% Generate series
Series = rand(100,1);
% Set the AR(1) - note the constant variance
Spec = garchset('R',1,'VarianceModel','Constant');
% Estimate
[Coeff,Errors,LLF] = garchfit(Spec,Series);
% Display
garchdisp(Coeff,Errors)
aicbic(LLF,garchcount(Coeff))
Alternatively:

댓글 수: 4

Michael
Michael 2011년 7월 31일
Hey, thanks for the answer, but would you be able to explain what the lines do? I'm not familiar with the code at all. Thanks!
Oleg Komarov
Oleg Komarov 2011년 7월 31일
garchset/fit are the functions used to estimate garch/armax models. There's no separate functions for ARMA modelling so you have to set the variance equation in the grach model to constant to estimate ARMAs.
To have an autoregressive of order one - AR(1) - I just specify R (read fucntions doc for more details).
Michael
Michael 2011년 7월 31일
Ok great, thanks, I managed to get sorted!
Luis Hernandez
Luis Hernandez 2017년 8월 16일
Hi Oleg!! Thank so much for the script!! I've fit an AR(1) model with that script. But, i want to know the meaning of 'K' parameter in coeff set. Is it the value of white noise variance? According to the documentation of garchset the 'K' parameter is just for GARCH models or conditional variance models, why that parameter appears in AR(1) model? Im working with several ARMAX models and need to know the value of that variance. How could find this value? Thanks in advance!!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Conditional Mean Models에 대해 자세히 알아보기

질문:

2011년 7월 31일

댓글:

2017년 8월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by