Dummy Variables

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

magister
Posts: 16
Joined: Tue Mar 08, 2016 4:14 pm

Re: Dummy Variables

Postby magister » Tue Mar 08, 2016 4:50 pm

Hi everyone! I'm trying to test seasonal anomalies in stock indexes prices on a weekly basis, using dummy variables. My intention is to test for differences in returns across the weeks, for each month. For instance, let's asume that the trading period starts on 3rd of January 2000, the first week being through 10th of January. The month ends on 31st of January.
I want to create five dummies for each week, but on a monthly basis.
I have converted 5 day daily returns into weekly returns and all weeks start on Monday. I just could't convert the returns into weekly frequency to account for other days; I mean if the trading period starts on Wednesdsy, the week to start on Wednesday and count each 7 days from now on. Thus, I would have 5 or 4 dummies, which is not I'm looking for.
My questions are:
1. How can I set up such dummy variables?
2. How can I address the frequency problem, described above? Eviews allows me to convert only into weekly frequency, without any other specifications.
Thank you in advance for your responses.
Regards,

Nicu

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

Re: Dummy Variables

Postby EViews Gareth » Tue Mar 08, 2016 5:24 pm

You'll have to explain in more detail.
Follow us on Twitter @IHSEViews

magister
Posts: 16
Joined: Tue Mar 08, 2016 4:14 pm

Re: Dummy Variables

Postby magister » Wed Mar 09, 2016 2:58 am

EViews Gareth wrote:You'll have to explain in more detail.

Hi, Gareth,

Thank you for your reply. I want to test stock market anomalies, and one of them is the so called "the week-of-the-month effect". More precisely, I want to test whether there are patterns in terms of weekly returns, for each month. For instance, the mean return for the first week of every month is statistically positive, while the mean returns for the remaining weeks of any month are statistically indistinguishable from zero For this purpose, I want to use OLS an create 4 or 5 dummies (depends on each month) for each week of each month. The regression equation is as follows: Rt=b1D1t+b2D2t+b3D3t+b4D4t+b5D5t+et, where Rt is the weekly return for week t. Of course, to avoid dummy trap, I will use only 4 dummies and a constant.

Thank you,

Nicu

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

Re: Dummy Variables

Postby EViews Gareth » Wed Mar 09, 2016 8:59 am

How do you want to define a week? i.e. how do you decide what is the first week of the month?
Follow us on Twitter @IHSEViews

magister
Posts: 16
Joined: Tue Mar 08, 2016 4:14 pm

Re: Dummy Variables

Postby magister » Wed Mar 09, 2016 3:38 pm

EViews Gareth wrote:How do you want to define a week? i.e. how do you decide what is the first week of the month?

Hi, Gareth,

To test for weekly effects, I use weekly returns which have been converted from daily returns using Eviews function. The sample is from 2000 through 2015. The first trading day is on 1/03/2000 (Monday) and as Eviews has converted the returns, it adds 7 days from this date. I attach the time-series data, to be more specific.

Thank you,

Nicu
Attachments
weekly.wf1
(21.33 KiB) Downloaded 134 times

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

Re: Dummy Variables

Postby EViews Gareth » Wed Mar 09, 2016 3:40 pm

That really doesn't address my question.
Follow us on Twitter @IHSEViews

magister
Posts: 16
Joined: Tue Mar 08, 2016 4:14 pm

Re: Dummy Variables

Postby magister » Wed Mar 09, 2016 4:02 pm

EViews Gareth wrote:That really doesn't address my question.

I don't know how to better explain, I thought that the workfile will bring more light here. The idea is that I want to create a dummy (d1) for the week from 1/03/2000 to 1/10/2000, d2 for 1/10/2000 to 1/17/2000, d3 for 1/17/2000 to 1/24/2000, d4 for 1/17/2000 to 1/24/2000 and d5 for 1/24/2000 to 1/31/2000. After this, d1 for 1/31/2000 to 2/07/2000, d2 for 2/07/2000 to 2/14/2000, d3 for 2/14/2000 to 2/21/1000 and d4 for 2/21/2000 to 2/28/2000, and so forth.

Thank you,


Nicu

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

Re: Dummy Variables

Postby EViews Gareth » Wed Mar 09, 2016 5:22 pm

ok, I think I see what you want (which is somewhat weird, but ok). You want 5 dummy variables that repeat after each other, each of length 7 observations. Do you actually want them to overlap? In your example, the date of 1/10/2000 is included in both D1 and D2.

Your explanation also has D3 and D4 as identical?

I should also point out that your current explanation is absolutely not what your first post requested.
Follow us on Twitter @IHSEViews

magister
Posts: 16
Joined: Tue Mar 08, 2016 4:14 pm

Re: Dummy Variables

Postby magister » Wed Mar 09, 2016 5:42 pm

EViews Gareth wrote:ok, I think I see what you want (which is somewhat weird, but ok). You want 5 dummy variables that repeat after each other, each of length 7 observations. Do you actually want them to overlap? In your example, the date of 1/10/2000 is included in both D1 and D2.

Your explanation also has D3 and D4 as identical?

I should also point out that your current explanation is absolutely not what your first post requested.

That's right. There will be 4 dummies, not 5 (my mistake), each of length 7 observation and I do not want them to overlap. I have given that example based on the days from workfile. The week actually starts on 1/03/2000 and ends on 1/9/2000, and that's exactly how I want to set up that dummies. Having included d3 and d4 as identical was a mistake.
Sorry for doubtfulness, but I am quite new in the area.
Hope to help me to carry it off well, it's a part of my dissertation.

Thank you,

Nicu

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

Re: Dummy Variables

Postby EViews Gareth » Wed Mar 09, 2016 9:12 pm

Code: Select all

series d1
d1.adjust = 1 r7 0 r21
d1 = @recode(@trend>27, d1(-28), d1)

series d2 = @recode(@trend>6, d1(-7), 0)
series d3 = @recode(@trend>13, d2(-7), 0)
series d4= @recode(@trend>20, d3(-7), 0)

show d1 d2 d3 d4
Follow us on Twitter @IHSEViews

magister
Posts: 16
Joined: Tue Mar 08, 2016 4:14 pm

Re: Dummy Variables

Postby magister » Thu Mar 10, 2016 1:53 am

EViews Gareth wrote:

Code: Select all

series d1
d1.adjust = 1 r7 0 r21
d1 = @recode(@trend>27, d1(-28), d1)

series d2 = @recode(@trend>6, d1(-7), 0)
series d3 = @recode(@trend>13, d2(-7), 0)
series d4= @recode(@trend>20, d3(-7), 0)

show d1 d2 d3 d4

Hi, Gareth,

I've tried to run the program but I've got the following error: ADJUST is not valid view for D1 in "DO_D1.ADJUST = 1 R7 0 R21".

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

Re: Dummy Variables

Postby EViews Gareth » Thu Mar 10, 2016 7:16 am

Which version of EViews?
Follow us on Twitter @IHSEViews

magister
Posts: 16
Joined: Tue Mar 08, 2016 4:14 pm

Re: Dummy Variables

Postby magister » Thu Mar 10, 2016 7:46 am

EViews Gareth wrote:Which version of EViews?

7.

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

Re: Dummy Variables

Postby EViews Gareth » Thu Mar 10, 2016 7:50 am

You'll need 8 or 9
Follow us on Twitter @IHSEViews

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

Re: Dummy Variables

Postby EViews Gareth » Thu Mar 10, 2016 8:32 am

The .adjust bit is just creating a sequence of seven 1s followed by twenty one 0s. You could do the same thing with series.fill instead by manually writing out that sequence.
Follow us on Twitter @IHSEViews


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 9 guests