Event Study- Sample by Estimation Window

For questions regarding programming in the EViews programming language.

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

DandD
Posts: 6
Joined: Mon May 19, 2014 11:08 am

Event Study- Sample by Estimation Window

Postby DandD » Mon May 19, 2014 11:24 am

Hi, we are absolutely new to eviews but have to conduct an event study. Now our first question is, if there is a way to automatically sample by an estimation window, which lies a specified time ahead of the eventdate, so that we can then caluclate from there 'alpha' and 'beta'. Is it possible to do so, or do we have to use Excel for this?


P.S.: (One thing to consider is hereby that we have various event dates for one stock, which we think would also result in various estimation windows).

Thx, yours DandD

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

Re: Event Study- Sample by Estimation Window

Postby EViews Glenn » Mon May 19, 2014 12:54 pm

Probably easy to do using the event date plus an offset. Are the event dates known ahead of time or do you derive them from data?

DandD
Posts: 6
Joined: Mon May 19, 2014 11:08 am

Re: Event Study- Sample by Estimation Window

Postby DandD » Mon May 19, 2014 2:19 pm

Probably easy to do using the event date plus an offset. Are the event dates known ahead of time or do you derive them from data?
Thank you for your quick answer. We know the event date (in our case we prepared all the needed data in an excel file and imported it into EViews). Our problem is that we have to calculate expected returns based on the market model. Thereby we have to use a linear regression including alpha and beta. Our task is to estimate the alpha and beta in the "estimation window" which lies ahead the "event window". Like in our case the event window includes 61 days, consisting of one event day, 10 days before the event and 50 days after the event. The estimation window starts exactly at 11 days before the event date and reaches 1 year back.
You have mentioned that we can use the event date plus an offset? How does it work exactly? (We are completely new at EViews and therefore we are very thankful for every help!)

For better understanding: We have an estimation window which lies ahead the event window. The event window includes the event day (T=0) and also 10 days preceding and 50 days following the event date. There exist no overlap between the estimation window and the event window. First step is to calculate expected returns (where we have to estimate beta and alpha in the estimation window) to determine in the following the abnormal returns and cumulative returns in the event window.

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

Re: Event Study- Sample by Estimation Window

Postby EViews Glenn » Mon May 19, 2014 7:44 pm

You should be able to specify your sample date pairs using date plus offset, as in

Code: Select all

smpl 1950q3-10 1950q3+50
Simply enter the line in the command window. This will restrict the sample for most operations until the sample is reset to something else. To set to the full workfile use

Code: Select all

smpl @all
The docs describe all of this in some detail.

DandD
Posts: 6
Joined: Mon May 19, 2014 11:08 am

Re: Event Study- Sample by Estimation Window

Postby DandD » Mon May 19, 2014 10:49 pm

You should be able to specify your sample date pairs using date plus offset, as in

Code: Select all

smpl 1950q3-10 1950q3+50
Simply enter the line in the command window. This will restrict the sample for most operations until the sample is reset to something else. To set to the full workfile use

Code: Select all

smpl @all
The docs describe all of this in some detail.

Thank you for your help. This command we already used but therefore we have to count (word-for-word) from every single event date back to the estimation window and this is quite elaborate. However, we thought that there exist a faster way to restrict the sample to our needed time period without counting it at first by hand to get the right dates for the estimation period.

DandD
Posts: 6
Joined: Mon May 19, 2014 11:08 am

Re: Event Study- Sample by Estimation Window

Postby DandD » Tue May 20, 2014 9:07 am

Another problem occurs concerning the following: We have many different companies with more than one event per company. We want to use a string loop to calculate the alpha and beta in the estimation window (which lies ahead the event window). The event dates are known and we determined a lengh for our estimaton window. How can we come up with: more than one event per company, to determine the estimaton window in EViews and to calculate alpha and beta in the estimation window?

One suggestion was that we put in the event dates in a table and use the sting command to determine the estimation window. But how does it work for many events per firm?

Thank you for your help :)

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

Re: Event Study- Sample by Estimation Window

Postby EViews Glenn » Tue May 20, 2014 10:56 am

There's a lot going on in your description which I'm afraid I don't follow completely. Can you fully describe your data, and what it is you are trying to do (with some examples if possible, or perhaps even the workfile)?

DandD
Posts: 6
Joined: Mon May 19, 2014 11:08 am

Re: Event Study- Sample by Estimation Window

Postby DandD » Wed May 21, 2014 10:13 am

First thank you for your help. We already managed the problem with the estimation window (alpha and beta) but now a new problem occured, namely this error term you will find below. Our idee behind this is, that our sample should be restricted to the event window. We created dummy variables where 1 indicates the event date. Our event window includes 61 days, consisting of -10 ahead the event date and +50 following the event date. Only in this time period we want to determine the expected, abnormal and cumulative abnormal returns.

For further info:

smpl @all

for !t=1 to 4

%eventdate=dummy_{%stock}_e!t=1
sample s_!t
delete s_!t
sample s_!t %eventdate-10 %eventdate+50

next

The error term is: Scalar assigned to string in "%eventdate=dummy_ZAG_e1t=1"

How can we manage this?

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

Re: Event Study- Sample by Estimation Window

Postby EViews Glenn » Wed May 21, 2014 11:25 am

The error is because you are mixing up numeric and string evaluation. You can't set a string value to the numbers. In particular,

Code: Select all

dummy_{%stock}_e!t=1
is a series numeric evaluation and you are trying to assign this to a string variable.

What you want to do is to get the obsassociated with the value of 1 and then grab the string representation of that the obs for that date.

First, create a series with the dates

Code: Select all

series dates= @date
We'll need that for finding the date numbers.

Then, the following lines inside of your loop

Code: Select all

smpl if dummy_{%stock}_e!t=1 ' sets sample to this observation (I'm assuming that there is a single 1) !dateval = @mean(dates) ' taking the means gives us the date value for the single observation %eventdate = @datestr(!dateval, "yyyy[q]q") ' this gives us the date string %startdate = %eventdate + "-10" ' build up start date string %enddate = %eventdate + "+50" ' build up end date string smpl {%startdate} {%enddate} ' set sample to the appropriate range
gets the desired date string and offsets and will set the sample accordingly.

DandD
Posts: 6
Joined: Mon May 19, 2014 11:08 am

Re: Event Study- Sample by Estimation Window

Postby DandD » Thu May 22, 2014 4:36 am

Thanks again for your help. We have now another problem: We want to restrict our abnormal returns to our event window (-10 ahead the event date and + 50 following the event date) but we do not know how it works.

Our commands:

smpl @all
for !t=1 to 22

%eventdate = output2(!t+1, 2)
sample s_!t
delete s_!t
sample s_!t %eventdate-10 %eventdate+50 'event window


series r_exp_!t=c(1)+c(2)*r_atx
series r_ab_!t=r_!t - r_exp_!t 'abnormal returns
series r_ab_e_!t=@(r_ab_!t, s_!t)
series r_cu_!t=@cumsum(r_!t, s_!t) 'cumulative abnormal returns; s=event window
series r_cu_exp_!t=@cumsum(r_exp_!t, s_!t) 'cumulative expected returns
series r_cu_ab_!t=@cumsum(r_ab_!t, s_!t) 'cumulative abnormal returns

next

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

Re: Event Study- Sample by Estimation Window

Postby EViews Glenn » Thu May 22, 2014 1:45 pm

Code: Select all

smpl s_!t series r_ab_!t=r_!t - r_exp_!t 'abnormal returns smpl @all
Note you can also put all of your other calculations inside the adjusted sample.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests