Create a table with unit root tests and p-values

For questions regarding programming in the EViews programming language.

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

cowanmr
Posts: 3
Joined: Wed Jun 18, 2014 3:37 pm

Create a table with unit root tests and p-values

Postby cowanmr » Thu Jun 19, 2014 10:21 am

Hi,

I would like to create a table that calculates the unit root and associated p-values for a group of time series. I have used some code from other posts but can't quite get the result I'm looking for. My table will include unit root tests both with and without a trend for comparison purposes and I would like to have the p-values in the columns next to the respective unit root tests (i.e. column 1 will have unit root w/o trend, column 2 will have the associated p-value, column 3 will have the unit root test w/trend and column 4 will have the associated p-value). Finally, I would like to have column headers that explain what each column contains. Here is the associated code I have used so far, which is able to calculate the unit roots without and then with trend:

'select a group
group unit_root

'create a table
table ADF

for !i = 1 to unit_root.@count

%U1 = unit_root.@seriesname(!i)
uroot(adf,const,dif=0,info=sic, save=level1) {%U1}
ADF(1+!i,1) = %u1
ADF(1 +!i,2) = level1(3,1)
uroot(adf,trend, dif=0, save=level2) {%U1}
ADF(1+!i,3) = level2(3,1)

next

Thanks for the help!

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

Re: Create a table with unit root tests and p-values

Postby EViews Gareth » Thu Jun 19, 2014 10:23 am

Which bit are you stuck on? - at first glance, what you have seems ok.

cowanmr
Posts: 3
Joined: Wed Jun 18, 2014 3:37 pm

Re: Create a table with unit root tests and p-values

Postby cowanmr » Thu Jun 19, 2014 10:30 am

It is calculating the unit roots, I just don't know how to get it to calculate the p-values.

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

Re: Create a table with unit root tests and p-values

Postby EViews Gareth » Thu Jun 19, 2014 10:38 am

They'll be stored in a row of level1 and level2. Probably level1(4,1) and level2(4,1)

cowanmr
Posts: 3
Joined: Wed Jun 18, 2014 3:37 pm

Re: Create a table with unit root tests and p-values

Postby cowanmr » Thu Jun 19, 2014 10:48 am

That did the trick, thanks!

Here is the final code that I used:

'select a group
group unit_root

'create a table
table ADF

for !i = 1 to unit_root.@count

%U1 = unit_root.@seriesname(!i)
uroot(adf,const,dif=0,info=sic, save=level1) {%U1}
ADF(1+!i,1) = %u1
ADF(1+!i,2) = level1(3,1)
ADF(1+!i,3) = level1(4,1)
uroot(adf,trend, dif=0, save=level2) {%U1}
ADF(1+!i,4) = level2(3,1)
ADF(1+!i,5) = level2(4,1)

next


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests