a simulation on AIC model selection

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

tony
Posts: 59
Joined: Wed Jan 07, 2009 7:59 am

a simulation on AIC model selection

Postby tony » Tue Nov 02, 2010 2:14 am

Hi everybody,
I perform a simulation on AIC model selection, in the literature, it is well known that AIC will lead to overfit,i.e take more lags than the true d.g.p,however,my codes result in a very different output, that is alway take one lag, no matter what the d.g.p is. below is the code, somebody help me please.Thany you very much.

Code: Select all

create a workfile !N=10000 !M=30 workfile simu1 u 1 !N 'create a variable series order equation eq for !j=1 to !N smpl 1 !M+100 series u=nrnd series v=nrnd series y y(1)=v(6) y(2)=v(8) y(3)=v(4) y(4)=v(2) smpl 5 !M y=0.2*y(-1)+0.1*y(-2)+0.1*y(-3)+0.1*y(-4)+u smpl 1 !M 'variable to store the minimum AIC. Initialise it to a large number !aic = 99999999 'variable saying how many lags to go up to !maxlags = 10 'Variable to store the "best" number of lags !bestlag = 0 'set sample to be the !maxlag'th value onwards smpl !maxlags !M for !i=1 to !maxlags eq.ls y c y(-1 to -!i) 'run regression of Y on a constant and lagged values of itself up to the iTH lag. if eq.@aic < !aic then !bestlag = !i 'if this lag specification has the best AIC, then store this lag as !bestlag. !aic = eq.@aic endif next smpl @all order(!j)=!bestlag 'reset sample next

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: a simulation on AIC model selection

Postby EViews Gareth » Tue Nov 02, 2010 8:03 am

I just ran your code, and although it often chose 1 lag, it often didn't (i.e. it chose other numbers). I can't see anything really wrong with your code, to be honest.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest