Dummy Variables
Moderators: EViews Gareth, EViews Moderator
Re: Dummy Variables
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
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

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

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12239
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables
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
Re: Dummy Variables
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 timeseries data, to be more specific.
Thank you,
Nicu
 Attachments

 weekly.wf1
 (21.33 KiB) Downloaded 196 times

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

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

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12239
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables
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
Re: Dummy Variables
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".

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12239
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables
EViews Gareth wrote:Which version of EViews?
7.

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

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12239
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables
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
Who is online
Users browsing this forum: No registered users and 2 guests