rtadf

For questions about EViews Add-ins available from the EViews Add-ins webpage. Note each add-in available on our webpage will have its own individual thread.

Moderators: EViews Gareth, EViews Moderator, EViews Esther

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

rtadf

Postby EViews Gareth » Wed Aug 28, 2013 10:58 am

This thread is about the rtadf by Itamar Caspi that performs four typs of right tailed unit root test that help detect price bubbles.
Follow us on Twitter @IHSEViews

Tintin
Posts: 4
Joined: Thu Mar 06, 2014 9:59 am

Re: rtadf programming

Postby Tintin » Thu Mar 06, 2014 10:13 am

I would like to ask whether the right-tail-adf-addin can be used through the programming interface? Or is it only accessible through the series object (proc menu dialog)?

Thanks

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

Re: rtadf

Postby EViews Gareth » Thu Mar 06, 2014 10:35 am

I don't believe so, but it shouldn't be too hard to modify it yourself to stop the GUI from being brought up.
Follow us on Twitter @IHSEViews

Itamar
Posts: 23
Joined: Wed Mar 12, 2014 12:31 pm

Re: rtadf

Postby Itamar » Wed Mar 12, 2014 12:37 pm

Actually, its on my to do list for this add-in. Gareth, can you please point me to a useful source on how to edit such a prompt command?

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

Re: rtadf

Postby EViews Gareth » Wed Mar 12, 2014 12:46 pm

Really there are just two functions you need - @hasoption and @equaloption. Both are documented in Chapter 6 of the Programming Reference.

Perhaps easier is just to look at some examples. I think the VARForecast add-in is probably a good start - it uses the @hasoption function to parse any options that were passed, and uses the %args keyword (which contains any program arguments) along with the @len function to test whether any arguments were given. If no arguments are given, it throws up a dialog.
Follow us on Twitter @IHSEViews

Itamar
Posts: 23
Joined: Wed Mar 12, 2014 12:31 pm

Re: rtadf

Postby Itamar » Wed Mar 12, 2014 1:11 pm

Thanks!
I hope I'll be able to do it soon enough...

Itamar
Posts: 23
Joined: Wed Mar 12, 2014 12:31 pm

Re: rtadf

Postby Itamar » Tue Mar 18, 2014 4:25 am

Ok, following Gareth's advice, I added a command option for the rtadf add in (in a quick and dirty way but it seems to work). Note that this is still experimental and it might have some bugs I missed. For it to work, you will need to replace the current rtadf.prg and rtadfsim.prg files which are in your EViews Addins\RTadf library with the attached new files.

Here is a short guide (Later on I will update the user guide):

Options:

model={1,2,3,4}; where 1=adf, 2=radf, 3=sadf, 4=gsadf
trim={}; is the window size (in fraction trems or in no. of observations)

const/trend/none; specification of the deterministic terms in the unit root test equation

info={fixed,aic,hqc,sic,maic,mhqc,msic}; information criteria for the lag length of the unit root test equation
lag={}; maximal lag length for the test equation (if "fixed" is chosen, this will be the fixed lag length)

sim; preform MC simulation for the critical values (this will prompt the simulation dialog once the calculation of the statistic is over)
graph; this will generate a graph of the results
print; this will print the spool with the result and the graph

Example:

The command,

y.rtadf(model=3, trim=0.3, trend, info=fixed, lag=1, graph, print)

will run a SADF test on y where the initial window size is set to 0.3 with a test equation specified with a constant and a trend and with one fixed lag. In addition, it will show a spool which holds the test statistic and a graph.

One caveat I have here is that, at least for now, the command cannot perform the test and the simulation automatically. However, if you wishe to preform the same test to several series having the same sample size and the same window, all you need to do is to do the simulation once, keep the critical values, and then run the same command for the remaining series (with the "sim" option shut off) via a loop.

I'll be happy to get your comments!

Enjoy bubbling...

PS, the addin now enables the user to specify the deterministic terms of the test equation, both in the test dialog and in the simulation dialog. In addition, the add in now calculates the p-value of the test statistic (according to the simulated distribution of the test statistic), but this is still an experimental feature.
Attachments
rtadfsim.prg
(7.52 KiB) Downloaded 472 times
rtadf.prg
(14.12 KiB) Downloaded 463 times

Itamar
Posts: 23
Joined: Wed Mar 12, 2014 12:31 pm

Re: rtadf

Postby Itamar » Thu Apr 03, 2014 6:40 am

A new version of the rtadf add-in is now available at the EViews add-in webpage (http://www.eviews.com/Addins/rtadf.aipz)

This version enables full automation of the test procedures via a command line and a new and detailed user guide.

Here is an example for a program that uses the command line capabilities to perform a group test:

Code: Select all

'Itamar Caspi, 03/04/2014

'This programs performs a group ADF/RADF/SADF/GSADF test. IMPORTANT: all series must be of the same sample size (no NAs)

%series="x y z" 'series to run the test on (replace "x y z" with your own series)
%sample="2004M1 2014M1" 'common sample
 
group g01 {%series}
 
d tstat_* stats* graphs* 'cleanup (note that this will delete the results of the latest run so if you wish to keep them, name them!)

table stats 'holds test statistics and CVs
spool graphs 'holds date-stamping graphs
 
!model=3 'type of test 1=ADF 2=RADF 3=SADF 4=GSADF
!lag=0 'number of lags in the test equation
!win=36 'minimal window size
!rep=200 'number of replications for the MC simulation
 

stats(1,1) = "99%"
stats(2,1) = "95%"
stats(3,1) = "90%"
 
if !model=1 then
     %model="ADF"
endif
if !model=2 then
     %model="RADF"
endif
if !model=3 then
     %model="SADF"
endif
if !model=4 then
     %model="GSADF"
endif
stats(6,2)=%model
 
'generate critical values for the common sample length using the first series as input
smpl %sample
%i=g01.@seriesname(1)
{%i}.rtadf(const,model=!model,lag=!lag,win=!win,sim, rep=!rep, d=0)
rtadf_spool.extract(tstat_{%i}) untitled01
close tstat_{%i}
for !i=1 to 3
     stats(!i,2)=tstat_{%i}(11+!i,4)
next
 
'generate test statistics for all series
!k=5
 for %i {%series}
     !k=!k+1
     smpl %sample
     {%i}.rtadf(const,model=!model,lag=!lag,win=!win)
     stats(!k+1,2)=@max({%model})
     stats(!k+1,1)=%i
     graph gr_{%i}.line {%model} {%model}_cv {%i}
     gr_{%i}.setelem(1) legend(%model)
     gr_{%i}.setelem(2) legend("95% CV")
     gr_{%i}.setelem(3) legend(%i)
     gr_{%i}.setelem(3) axis(r)
     gr_{%i}.options backcolor(white) backfade(none)
     graphs.append gr_{%i}
     d gr_{%i}
next
 
'modify output spool
graphs.flatten
graphs.options -tree -titles -margins -borders

 'print results
show stats
show graphs


Enjoy bubbling!

caimano6
Posts: 1
Joined: Mon Apr 07, 2014 1:04 pm

Re: rtadf

Postby caimano6 » Mon Apr 07, 2014 1:20 pm

Dear Itamar,
when i use your add in I cant't obtain the output spool because eviews returned me the message beta_pc is not defined at the end of simulation.
Could you help me to understand the reason for this errors?
Thank you for your help

Itamar
Posts: 23
Joined: Wed Mar 12, 2014 12:31 pm

Re: rtadf

Postby Itamar » Tue Apr 08, 2014 9:40 pm

Hi

I suspect it is due to a broken simulation, i.e., a simulation not completed. When this happens the cleanup of the temporary variables is not completed and this may cause this problem. A quick solution might be to start fresh - open a new workfile with the series in question and run the test again.

In order to fix this problem permanently, I'll appreciate it if you can send me your workfile along with details on the kind of test you used and on which series.

Thanks

quangluu
Posts: 2
Joined: Sat Aug 23, 2014 6:34 pm

Re rtadf: explain the output of gsadf test

Postby quangluu » Sat Aug 23, 2014 6:42 pm

Hi,

I run a radf test using gsadf option. Eviews gives me a number of output objects after the test including:

gsadf
gsadf_cv
gsadf_vec
level
max_adf
rtadf_spool

Im relatively new to this test, can someone help me explain what above output mean?

Quang

Itamar
Posts: 23
Joined: Wed Mar 12, 2014 12:31 pm

Re: rtadf

Postby Itamar » Wed Aug 27, 2014 4:55 am

Hi,

gsadf - This is the sequence of BSADF statistics. It is the Blue line in the graph. See the manual attached to the add-in for a definition. (Add-ins->Manage add-ins then point at 'rtadf' and click on 'Docs'.)
gsadf_cv - This is the sequence of critical values. This sequence and the 'gsadf' are used for date stamping bubbles. It is the RED line in the graph.
gsadf_vec - This holds the values of 'gsadf_cv' in the form of a vector. (can be ignored. I'll probably clean it in the next update of the add-in.)
level - output from the unit root test. Can be ignored. I'll probably clean it in the next update of the add-in.
max_adf - can be ignored. I'll probably clean it in the next update of the add-in.
rtadf_spool - This is the main output of the add-in. It has a table that holds the test statistic, critical values and p-value. Furthermore, the spool includes a graph of the tested series, gsdaf and gsadf_cv. The graph allows us to visualize the bubble date stamping procedure.

Hope this helps.

Itamar

quangluu
Posts: 2
Joined: Sat Aug 23, 2014 6:34 pm

Re: rtadf

Postby quangluu » Wed Aug 27, 2014 2:37 pm

Hi Itarma,

Thanks for your response. Your explanation is very useful.

Quang

ioanniskork
Posts: 2
Joined: Wed Sep 03, 2014 4:24 am

Re: rtadf

Postby ioanniskork » Wed Sep 03, 2014 4:35 am

Dear Itamar,

Thanks for your usefull add-in. I have some queries however. First of all, why do you mention that "gsadf - This is the sequence of BSADF statistics"? I would say that BSADF process in another method different from the GSADF.

Secondly, I cannot see any window with the "gsadf_cv" name on it. Where should I find the critical values resulting from Monte Carlo simulations?

Finally, you talked about the rolling ADF? Could you be more precise regarding the test you refer to?

Thank you in advance.

Regards,
Ioannis

Itamar
Posts: 23
Joined: Wed Mar 12, 2014 12:31 pm

Re: rtadf

Postby Itamar » Fri Sep 05, 2014 1:57 pm

Dear Ioannis,

1. The 'gsadf' series is one of the output objects from the add-in. It is basically what Phillips et al. refer to as the BSADF sequence (ban naming, I know... I might fix it in the next update).

2. If you run the GSADF test with the simulation option checked, you sould get a series object named 'gsadf_cv'. This series is the red line in the graph.

3. The rolling ADF test is basically a fixed rolling window version of the ADF test. Phillips et al. (2011) (PWY) use this test as a robustness check in their paper.

Hope this helps

Itamar.


Return to “Add-in Support”

Who is online

Users browsing this forum: No registered users and 2 guests