Outputting Johansen test results to a spool

For questions regarding programming in the EViews programming language.

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

rdwest
Posts: 18
Joined: Wed Dec 23, 2009 11:35 am

Outputting Johansen test results to a spool

Postby rdwest » Mon Mar 08, 2010 11:31 am

Hello,

I am trying to run multiple Johansen tests, and save the output to a spool. I don't know of another way to do this other than with the output(s) command. The below program worked fine previously -- but rerunning it recently, none of the output goes to spool anymore: it just pops up window after window for each individual test output. The spools remain unpopulated.

I haven't changed anything about the program itself -- is it possible that I've changed one of the default settings (for printing or something) that would be causing this? The entire program runs over a hundred tests, and exceeds the allowable number of windows in Eviews....

Here is the relevant piece of code. Any help would be greatly appreciated!

Thank you,
Rachel



call v_all_coint

subroutine v_all_coint

for %vehicle ld
call {%vehicle}_coint_tests
next

endsub




Subroutine {%vehicle}_coint_tests


open "all_data.wf1"

smpl @all

cd "Code\Logs"




if %vehicle = "ld" then
!m = 11

%vars_1 = "(ld_total_vmt/pop) (real_gdp_2005$/pop) (real_gas_2000$/ld_mpg) @ (pop/nhh)"
%vars_2 = "(ld_total_vmt/pop) (real_pers_disp_inc_2005$/pop) (real_gas_2000$/ld_mpg) @ (pop/nhh)"
%vars_3 = "(ld_total_vmt/pop) (real_pers_disp_inc_2005$/pop) (real_gas_2000$/ld_mpg) (cities_with_transit)"
%vars_4 = "(ld_total_vmt/pop) (real_pers_disp_inc_2005$/pop) (real_gas_2000$/ld_mpg) (new_vehicle_price_2005$) @ (pop/nhh) (total_prm/pop)"
%vars_5 = "(ld_total_vmt/pop) (real_pers_disp_inc_2005$/pop) (real_gas_2000$/ld_mpg) (new_vehicle_price_2005$) (cities_with_transit) @ (total_prm/pop)"
%vars_6 = "(ld_total_vmt/pop) (real_pers_disp_inc_2005$/pop) (real_gas_2000$/ld_mpg) (new_vehicle_price_2005$) (cities_with_transit) @ (pop/nhh) (total_prm/pop)"
%vars_7 = "(ld_total_vmt/pop) (real_pers_disp_inc_2005$/pop) (real_gas_2000$/ld_mpg) (new_vehicle_price_2005$) (bus_and_rail_miles/pop) @ (pop/nhh) (total_prm/pop)"
%vars_8 = "(ld_total_vmt/pop) (real_pers_disp_inc_2005$/pop) (real_gas_2000$/ld_mpg) (new_vehicle_price_2005$) @ (pop/nhh)"
%vars_9 = "(ld_total_vmt/pop) percent_pop_ne+percent_pop_mw (real_pers_disp_inc_2005$/pop) (real_gas_2000$/ld_mpg) (percent_pop_ne+percent_pop_mw)*percent_pop_urban @ percent_pop_urban"
%vars_10 = "(ld_total_vmt/pop) percent_pop_ne+percent_pop_mw (real_pers_disp_inc_2005$/pop) (real_gas_2000$/ld_mpg) (new_vehicle_price_2005$) (percent_pop_ne+percent_pop_mw)*percent_pop_urban @ percent_pop_urban"
%vars_11 = "(ld_total_vmt/pop) percent_pop_ne+percent_pop_mw (real_pers_disp_inc_2005$/pop) (real_gas_2000$/ld_mpg) (percent_pop_ne+percent_pop_mw)*percent_pop_urban @ (pop/nhh) percent_pop_urban"


endif




''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Set parameters and create spool
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
%test = "c" 'Sets the test option (i.e., trend and intercept assumptions): see p. 203 of Eviews command reference
for !n = 1 to 3 'Number of lags

spool coint_spool_{%vehicle}_{!n}lag
output(s) coint_spool_{%vehicle}_{!n}lag
coint_spool_{%vehicle}_{!n}lag.tablemode(type=variable)
coint_spool_{%vehicle}_{!n}lag.width 10


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Cointegration Tests
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

for !i = 1 to !m

coint({%test}, {!n}) {%vars_{!i}}

next

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

Re: Outputting Johansen test results to a spool

Postby EViews Gareth » Mon Mar 08, 2010 12:02 pm

I'm not really sure I can think of any global option or setting that you could have changed which would stop it from working (which doesn't mean such a thing doesn't exist, just that I can't think of one).

The spool isn't being populated because you aren't printing anything. You could change this by adding a pon command before doing the cointegration tests, which will then "print" them to the spool. However that won't stop the windows from opening. You could, I suppose, add a command to close the windows after they've opened by using "close @objects".


A better, more complicated solution, would be to use the append command to add things to the spool, rather than relying on print. However that is somewhat troublesome in your particular program, since append requires an object view rather than a command. You're using the command form of coint, rather than the object view form (for what it is worth, I always prefer to use object views/proc rather than global commands).

To do this you'll have to make a group from the series you wish to perform cointegration on, and then append the coint view of the group.

For example:

Code: Select all

spool myspool group g1 x y z myspool.append g1.coint(c,1)
I realise that takes a fair bit of reworking of your program.

rdwest
Posts: 18
Joined: Wed Dec 23, 2009 11:35 am

Re: Outputting Johansen test results to a spool

Postby rdwest » Mon Mar 08, 2010 12:24 pm

Thank you, Garreth! Both of those ideas make great solutions.

I definitely see the advantages of having the test results saved as individual objects -- and I would choose that route, except for the difficulty of specifying the exogenous variables in the test once a group is made (.... @ ....). I don't see an easy way around this (do you know one off the top of your head?) -- but printing and forcing the windows to close with the close @objects command works just fine!

Thanks again!
-R.

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

Re: Outputting Johansen test results to a spool

Postby EViews Gareth » Mon Mar 08, 2010 12:42 pm

Starting with one of your current expressions:

%vars_1 = "(ld_total_vmt/pop) (real_gdp_2005$/pop) (real_gas_2000$/ld_mpg) @ (pop/nhh)"

it is pretty easy to parse that into the group spec and the exogenous spec:

Code: Select all

!posat = @instr(%vars_1,"@") %grpdef = @left(%vars_1,!posat-1) %exogdef = @mid(%vars_1,!posat+1) group mygroup {%grpdef} myspool.append mygroup.coint(c,1) @ {%exogdef}

rdwest
Posts: 18
Joined: Wed Dec 23, 2009 11:35 am

Re: Outputting Johansen test results to a spool

Postby rdwest » Tue Mar 09, 2010 5:16 pm

Thanks again, Garreth! That's very helpful.

-R.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 0 guests