Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

For questions regarding programming in the EViews programming language.

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

cooney.sp
Posts: 6
Joined: Thu Jun 28, 2012 8:13 am

Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby cooney.sp » Thu Jun 28, 2012 9:20 am

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).

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby EViews Glenn » Mon Jul 02, 2012 10:24 am

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.

cooney.sp
Posts: 6
Joined: Thu Jun 28, 2012 8:13 am

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby cooney.sp » Wed Jul 04, 2012 10:17 am

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

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

Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby EViews Gareth » Wed Jul 04, 2012 10:47 am

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.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby EViews Glenn » Thu Jul 05, 2012 3:04 pm

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! :))

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby startz » Thu Jul 05, 2012 3:14 pm

You might want to do a quick count around the office of how many are subjects of the Queen before making such posts.

cooney.sp
Posts: 6
Joined: Thu Jun 28, 2012 8:13 am

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby cooney.sp » Thu Jul 12, 2012 9:07 am

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

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby EViews Glenn » Thu Jul 12, 2012 9:48 am

Yes, though you don't need the "adf" since that's the default.

cooney.sp
Posts: 6
Joined: Thu Jun 28, 2012 8:13 am

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby cooney.sp » Thu Jul 12, 2012 12:27 pm

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.
Attachments
t - returns.csv
Original return data that rolling tests were conducted on
(64.88 KiB) Downloaded 386 times
T (adf,trend) - unit root.xls
Unit Root Test
(360.5 KiB) Downloaded 398 times
T - vratio.xls
Variance Ratio
(366.5 KiB) Downloaded 415 times

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby EViews Glenn » Thu Jul 12, 2012 1:42 pm

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.

cooney.sp
Posts: 6
Joined: Thu Jun 28, 2012 8:13 am

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby cooney.sp » Thu Jul 12, 2012 3:20 pm

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,

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby EViews Glenn » Thu Jul 12, 2012 3:58 pm

As I mentioned in the original posting on this my quick-and-dirty example program saves both the stat values and p-values.

cooney.sp
Posts: 6
Joined: Thu Jun 28, 2012 8:13 am

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby cooney.sp » Fri Jul 13, 2012 1:40 pm

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,

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby EViews Glenn » Mon Jul 16, 2012 10:29 am

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).

Sara Elsayed
Posts: 8
Joined: Thu Jul 24, 2014 12:03 pm

Re: Rolling: Variance Ratio, Dickey Fuller, Autocorrelation

Postby Sara Elsayed » Tue Jul 29, 2014 6:49 am

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


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests