Event Study- Sample by Estimation Window
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Event Study- Sample by Estimation Window
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
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
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?
Re: Event Study- Sample by Estimation Window
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.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?
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
You should be able to specify your sample date pairs using date plus offset, as in
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
The docs describe all of this in some detail.
Code: Select all
smpl 1950q3-10 1950q3+50Code: Select all
smpl @allRe: Event Study- Sample by Estimation Window
You should be able to specify your sample date pairs using date plus offset, as inSimply 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 useCode: Select all
smpl 1950q3-10 1950q3+50The docs describe all of this in some detail.Code: Select all
smpl @all
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.
Re: Event Study- Sample by Estimation Window
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 :)
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
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)?
Re: Event Study- Sample by Estimation Window
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?
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
The error is because you are mixing up numeric and string evaluation. You can't set a string value to the numbers. In particular,
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
We'll need that for finding the date numbers.
Then, the following lines inside of your loop
gets the desired date string and offsets and will set the sample accordingly.
Code: Select all
dummy_{%stock}_e!t=1What 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= @dateThen, 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
Re: Event Study- Sample by Estimation Window
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
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
Code: Select all
smpl s_!t
series r_ab_!t=r_!t - r_exp_!t 'abnormal returns
smpl @all
Who is online
Users browsing this forum: No registered users and 2 guests
