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!
Create a table with unit root tests and p-values
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: Create a table with unit root tests and p-values
Which bit are you stuck on? - at first glance, what you have seems ok.
Re: Create a table with unit root tests and p-values
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
They'll be stored in a row of level1 and level2. Probably level1(4,1) and level2(4,1)
Re: Create a table with unit root tests and p-values
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
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
Who is online
Users browsing this forum: No registered users and 2 guests
