rtadf
Moderators: EViews Gareth, EViews Moderator, EViews Esther

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11773
 Joined: Tue Sep 16, 2008 5:38 pm
rtadf
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
Re: rtadf programming
I would like to ask whether the righttailadfaddin can be used through the programming interface? Or is it only accessible through the series object (proc menu dialog)?
Thanks
Thanks

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11773
 Joined: Tue Sep 16, 2008 5:38 pm
Re: rtadf
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

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11773
 Joined: Tue Sep 16, 2008 5:38 pm
Re: rtadf
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 addin 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.
Perhaps easier is just to look at some examples. I think the VARForecast addin 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
Re: rtadf
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 pvalue of the test statistic (according to the simulated distribution of the test statistic), but this is still an experimental feature.
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 pvalue 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 542 times

 rtadf.prg
 (14.12 KiB) Downloaded 540 times
Re: rtadf
A new version of the rtadf addin is now available at the EViews addin 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:
Enjoy bubbling!
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 datestamping 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!
Re: rtadf
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
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
Re: rtadf
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
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
Re rtadf: explain the output of gsadf test
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
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
Re: rtadf
Hi,
gsadf  This is the sequence of BSADF statistics. It is the Blue line in the graph. See the manual attached to the addin for a definition. (Addins>Manage addins 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 addin.)
level  output from the unit root test. Can be ignored. I'll probably clean it in the next update of the addin.
max_adf  can be ignored. I'll probably clean it in the next update of the addin.
rtadf_spool  This is the main output of the addin. It has a table that holds the test statistic, critical values and pvalue. 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
gsadf  This is the sequence of BSADF statistics. It is the Blue line in the graph. See the manual attached to the addin for a definition. (Addins>Manage addins 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 addin.)
level  output from the unit root test. Can be ignored. I'll probably clean it in the next update of the addin.
max_adf  can be ignored. I'll probably clean it in the next update of the addin.
rtadf_spool  This is the main output of the addin. It has a table that holds the test statistic, critical values and pvalue. 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

 Posts: 2
 Joined: Wed Sep 03, 2014 4:24 am
Re: rtadf
Dear Itamar,
Thanks for your usefull addin. 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
Thanks for your usefull addin. 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
Re: rtadf
Dear Ioannis,
1. The 'gsadf' series is one of the output objects from the addin. 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.
1. The 'gsadf' series is one of the output objects from the addin. 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.
Who is online
Users browsing this forum: No registered users and 1 guest