Hi,
I am trying to run a routine to perform the best lag selection for a regression. When I run it it doesn't pick the best lag, but rather takes the last lag available.
The routine looks like this
for !i=0 to 12
!r2=0
%fcistring= " "
%fcibest=" "
if !i=0 then %fcistring= "fci"+@str({!j}{!k}{!l}{!m}{!n}{!o}{!p})
else %fcistring= "fci"+@str({!j}{!k}{!l}{!m}{!n}{!o}{!p})+ "("+@str(-{!i})+")"
endif
smpl 2005m09 @last-12
equation r{!j}{!k}{!l}{!m}{!n}{!o}{!p}
r{!j}{!k}{!l}{!m}{!n}{!o}{!p}.ls g c {%arstring} {%fcistring}
if r{!j}{!k}{!l}{!m}{!n}{!o}{!p}.@rbar2>!r2 then
!r2=r{!j}{!k}{!l}{!m}{!n}{!o}{!p}.@rbar2
%fcibest =%fcistring
r{!j}{!k}{!l}{!m}{!n}{!o}{!p}.ls g c {%arstring} {%fcibest}
else delete r{!j}{!k}{!l}{!m}{!n}{!o}{!p}
endif
next
Can someone give me a hand? I really appreciate it
Automatic Lag Selection
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Automatic Lag Selection
I don't see anything that jumps out at me as being wrong.
-
camilogong
- Posts: 6
- Joined: Tue Jul 24, 2012 6:44 pm
Re: Automatic Lag Selection
I know, that is what is driving me completely crazy.
Could you run the routine and see if you get any different results?
I attach the program and the xls
Rgds
Could you run the routine and see if you get any different results?
I attach the program and the xls
Rgds
- Attachments
-
- fci_colombia.xls
- (53.5 KiB) Downloaded 246 times
-
- fci_colombia.prg
- (8.17 KiB) Downloaded 249 times
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Automatic Lag Selection
You're resetting !r2 inside the loop :D
Move the !r2=0 to before the for loop.
Also, from an econometric point of view, you might want to check you're using the same number of observations in each equation.
Move the !r2=0 to before the for loop.
Also, from an econometric point of view, you might want to check you're using the same number of observations in each equation.
-
camilogong
- Posts: 6
- Joined: Tue Jul 24, 2012 6:44 pm
Re: Automatic Lag Selection
Actually, setting the !r2 outside of the loop makes does not change matters all that much, as it still does not do the lag selection
What puzzles me is that I am currently runninng an identical program for another country and that one seems to be runnning (and doing the lag selection) fine (attached).
You are right that I need to set a fixed sample for the selection criteria to make sense.
Any clue would be greatly appreciated.
What puzzles me is that I am currently runninng an identical program for another country and that one seems to be runnning (and doing the lag selection) fine (attached).
You are right that I need to set a fixed sample for the selection criteria to make sense.
Any clue would be greatly appreciated.
- Attachments
-
- fci_chile.xls
- (88.5 KiB) Downloaded 262 times
-
- fci_chile.prg
- (8.8 KiB) Downloaded 249 times
Who is online
Users browsing this forum: No registered users and 2 guests
