Page 1 of 2

Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Thu Jun 28, 2012 9:20 am
by cooney.sp
Good Afternoon,

I am wondering if anyone can provide me with a code to run a rolling window (of 250) on a data set of returns for the following three tests: Variance Ratio, Augmented Dickey Fuller and Autocorrelations.

Thank you very much,
Sean

P.S.

Please let me know if you need the data. Data is currently from EViews 5, but I will be purchasing EViews 7 if someone can help me with this (I realize there is no Variance Ratio test in EViews 5).

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Mon Jul 02, 2012 10:24 am
by EViews Glenn
This snippet computes widowed ADF unit root and variance ratio tests on the series PROBLEMR on all of the windows of with 20 in a workfile and saves the stat values and p-values into the matrices UROOT and VRATIO. If you change the settings in the variance ratio test and the unit root tests you may have to locate the results in difference cells of the temp matrices AA and BB.

Note that the key here is that I use offsets from the first observation in the sample statement (smpl). The only tricky part is to make certain that we know the number of value intervals in the workfile (by looking at the number of observations and looking backward using the window width) and that we get the endpoint math in the interval definition right...

Code: Select all

!width = 20 !lastfirst = @obsrange-!width+1 matrix(!lastfirst, 2) vratio matrix(!lastfirst, 2) uroot for !i=1 to !lastfirst smpl @first+!i-1 @first+!i-1+!width-1 freeze(aa) problemr.vratio 2 4 8 16 vratio(!i, 1) = @val(aa(9, 3)) vratio(!i, 2) = @val(aa(9, 5)) freeze(bb) problemr.uroot(const) uroot(!i, 1) = @val(bb(7, 4)) uroot(!i, 2) = @val(bb(7, 5)) if (@isobject("aa")) then delete aa endif if (@isobject("bb")) then delete bb endif next
It should be pretty easy to modify this code as needed. Note that I didn't do the autocorrelation one since I"m not entirely certain which statistic you want.

Note also that there are more sophisticated examples provided with your copy of EViews.

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Wed Jul 04, 2012 10:17 am
by cooney.sp
EViews Glenn,

Thank you very much for this information.

At this point in time I would say that I understand about 90% of what you provided. I realize the office is closed today, but on July 5th are you able to take a call, or should I just call the general customer help and be transferred to the Technical Support team?

Thanks,
Sean

Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Wed Jul 04, 2012 10:47 am
by EViews Gareth
Emailing support@eviews.com with your question and serial number is generally the best way - questions over the phone, especially programming questions tend to be more tricky to answer clearly.

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Thu Jul 05, 2012 3:04 pm
by EViews Glenn
I just answered the phone call on this one, which I have no problems with though it's at the boundaries of our tech support.

I will mention that posting any questions that you might have to the forum may be a better way to approach this since at that point anyone can answer (and other people, in particular Gareth monitor the forums more diligently than I) and since others will then benefit from the response. This is especially true when you are looking for a response after hours or on significant holidays representing my country throwing off the yoke of repression (sorry Gareth! :))

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Thu Jul 05, 2012 3:14 pm
by startz
You might want to do a quick count around the office of how many are subjects of the Queen before making such posts.

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Thu Jul 12, 2012 9:07 am
by cooney.sp
Thank you again for all of the help EViews Glenn and Gareth.

One quick question. If I change the following line:

freeze(bb) problemr.uroot(const)

to:

freeze(bb) problemr.uroot(adf,trend)

Will that run the unit root test with both a constant and trend? And, specifically as the augmented dickey fuller unit root test?

Thanks,
Sean

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Thu Jul 12, 2012 9:48 am
by EViews Glenn
Yes, though you don't need the "adf" since that's the default.

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Thu Jul 12, 2012 12:27 pm
by cooney.sp
Hi Again,

I have attached the outputs of the rolling tests in excel format below (Unit Root and Variance Ratio).

The headers to the outputs are C1 and C2. In each example, what would C1 and C2 stand for?

Also, if one does a non-rolling variance ratio test they will get outputs for each 2, 4, 8, 16 (or 2, 5, 10, 20 as I used), but in the rolling test there is not outputs for each. Is this something to be concerned about?

Thanks

P.S. - In case it is useful I have also attached the original return data that the rolling tests were done on.

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Thu Jul 12, 2012 1:42 pm
by EViews Glenn
I'm not certain that I understand the question. If C1 and C2 came from the EViews matrix, they're just column headers for Column 1 and Column 2.

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Thu Jul 12, 2012 3:20 pm
by cooney.sp
My apologies for not wording my question in an understandable manner.

In regards to C1 and C2, I think you are probably right that this is Column 1 and 2.

What I guess I meant to ask is the following:

What do the data-points below C1 and C2 represent.

For example, for the unit root test, are the data-points in column 1 some sort of coefficient and the data points in column 2 representative of the probability of that coefficient being insignificant?

For the variance ratio test, I am wondering the same. What do the data-points in each column represent.

Thank you,

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Thu Jul 12, 2012 3:58 pm
by EViews Glenn
As I mentioned in the original posting on this my quick-and-dirty example program saves both the stat values and p-values.

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Fri Jul 13, 2012 1:40 pm
by cooney.sp
Thanks again for the info (and sorry for missing it above). A couple more questions, hopefully simple to answer.

I just want to confirm what the "stat value" would be for both of the tests.

Variance Ratio Test
- Is this the "Max Z-Statistic" for the joint test of each window?

Unit Root Test
- Is this the "t-statistic" on the first lag?

If I am incorrect on these, could you please correct me.

Thank you,

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Mon Jul 16, 2012 10:29 am
by EViews Glenn
If you compare them to the corresponding values in the test for one of your windows you'll see that this is the case. Note that all that we did here was to identify the cell containing the value (row and column of the output). You should take care to note whether the thing you are rolling possibly puts results in different places (in these cases, I believe that this is true).

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Posted: Tue Jul 29, 2014 6:49 am
by Sara Elsayed
can I have questions regarding the programming of rolling window?
First:
what do these lines refer to?
vratio(!i, 1) = @val(aa(9, 3))
vratio(!i, 2) = @val(aa(9, 5))
what is 9,3,5 ?! I can not understand

Second:
what if i want to do rolling for MVR using bootstrap option not asymptotic?
Are p-values in results refer to wild p-value or just p-value for conventional chow and Denning for each sample using asymptotic option?

Please, help