*! version 12.0 13 Mar 2013

help eventstudy

Title

eventstudy -- Module to do an eventstudy

Syntax

eventstudy
using
filename
,
options

Event File
event_file_name(EventFile) Specify the event file with path, which contains a list of events with even id,event firm id or ticker, event date and other control variables.

event_id(EventID) Specify variable name which stands for the event id in the even file specified by option event_file_name(EventFile) .

event_date(EventDate) Specify variable name in event file which stands for the event date.

event_firm_id(EventFirmID) Specify variable name in event file which stands for the firm id or ticker.

event_control(EventControls) Specify variable names in event file, which has nothing to do with the CAR calculation, but may be used in later investigations. We call those variables as conrols.

Trade File
trade_file_name(TradeFile) Specify the event file with a path. This file ought to be a Stata's .dta file.

firm_id(FirmID) Specify variable name in trade file which stands for firm id or ticker.

trade_date(TradeDate) Specify the variable name stands for trading date in the trade data file.

rit(rit) Specify the variable which stands for individual stock's daily return.

rmt(rmt) Specify the variable which stands for market's daily return.

Method
est_window_st(#) Set the start date of the estimate window. The default is -200, which stands for a date 200 tradding days before the event.

est_window_end(#) Set the end date of the estimate window. The default is -10, which stands for a date 10 tradding days before the event.

event_window_st(#) Set the start date of the event window. The default is -3, which stands for a date 3 tradding days before the event.

event_window_end(#) Set the end date of the estimate window. The default is 3, which stands for a date 3 tradding days after the event

If your filename or file path contains spaces, remember to enclose it in double quotes

Description

eventstudy can carry out a standard market model event study. it calculate the abnormal returns and Cumulative abnormal returns for each event.

To run this command, you have to specify the parameters on event file, trading file, and event windows by using option.

You need to choose a event file and a trading file, but they must contain some necessary variables as below:

Event file must contain variable of event code which identify each record uniqely, must contain variable of event
date that record the date when the event happens, must contain variable of event firm id which identify subject of each event record. For instance:

event_id	event_date	firm_id	event_control	event_control1	event_control2
1	2015 10 19	26	.0000118	.7135224	.9420305
2	2009 02 16	32	3.66e-06	.838579 .5355735
3	2024 04 29	46	7.20e-06	.5568867	.4753747
4	2020 12 01	48	7.22e-06	.9708269	.0968665
5	2022 07 04	48	4.51e-06	.0298252	.4498624
... ... ... ... ... ...

Trading file must contain varible of firm id whic identify every company uniqely, must contain variable of trading date, and must contain variable of stock return and market return for every company on each trading date.For instance:

firm_id trade_date rit rmt
23 2000 08 30	-.0206074	.0240483
23 2000 08 31	.0427704	.0123303
23 2000 09 01 .0177395 -.0137796
... ... ... ...
85 2024 11 07	-.0026962	-.0134778
85 2024 11 08	.0309724	.0086254
85 2024 11 12	-.0185169	.0192949
... ... ... ...

As to the study method, you have to specify the relative date to event date to set the event window and estimate window.

For example, you may choose (-200-10) as the estimate window, and (-3,+2) as event window,

then you may set the option like this: ...est_window_st(-200) est_window_end(-10) event_window_st(-3) event_window_end(2).

In this command, we use market model to calculate the abnormal return.

the result file will be stored in using filename which contains variables of event code,

event control variables(variables you preserve in evnet file and can be more than one), AR, and CAR.

Since the options are too many, you are highly recommended to run this command with the dialog box. you can input "db eventstudy" in the command window.

The dialog box is quite self-explainary just try it after you running the following program to simulate an event file, a trading data file.

Or, you can also use your own data to test this program. Good Luck!

Example1

// To generate sample data set of Event by simulation

clear all
set more off
set obs 1000000

gen int firm_id = _n/10000+23
replace firm_id =23 if firm_id==123
sort firm_id

by firm_id: gen trade_date = _n+mdy(8,29,2000)
format trade_date %dCY_N_D
drop if dow(trade_date)==0 | dow(trade_date)==6
drop if uniform()<.02

sort trade_date
bysort trade_date: gen rmt =(uniform()-0.5)*0.05
gen rit=.
forval i = 23(1) 123 {
local beta = uniform()*3-0.8
qui replace rit = `beta'*rmt+invnorm(uniform())*0.03 if firm_id==`i'
}

sort firm_id trade_date
order firm_id trade_date rit rmt
save trade, replace

keep firm_id trade_date
gen rand = uniform()
sort rand
keep if _n <= 10
rename rand event_control
gen event_control1=uniform()
gen event_control2=uniform()
sort firm_id trade_date
gen event_id = _n
rename trade_date event_date
order event_id event_date firm_id event_control event_control1 event_control2
save event, replace

//describe sampe event file and trade file

describe using event.dta
describe using trade.dta

//defing some locals represent the parameters

local event_file_name event.dta
local event_id event_id
local event_firm_id firm_id
local event_date event_date
local event_control "event_control event_control1 event_control2"

local trade_file_name trade.dta
local trade_rit rit
local trade_rmt rmt
local trade_firm_id firm_id
local trade_date trade_date

local event_window_st = -3
local event_window_end = 2
local est_window_st = -200
local est_window_end = -10
//run the command, result will be saved in d:\result.dta

eventstudy using d:\result.dta ,event_file_name(`event_file_name') ///
trade_file_name(`trade_file_name') rit(`trade_rit') ///
rmt(`trade_rmt') firm_id(`trade_firm_id') ///
trade_date(`trade_date') event_id(`event_id') ///
event_control(`event_control') event_firm_id(`event_firm_id') ///
event_date(`event_date') event_window_st(`event_window_st') ///
event_window_end(`event_window_end') est_window_st(`est_window_st') ///
est_window_end(`est_window_end')
//erase the sample data set
erase event.dta
erase trade.dta

Example2

//after generate sample data set, run this command in dialog box:

db eventstudy

Author

Xuan Zhang

Zhongnan University of Economics and Law

Wuhan, China

zhangx@znufe.edu.cn

Chuntao Li

Zhongnan University of Economics and Law

Wuhan, China

chtl@znufe.edu.cn

Xin Xu

Zhongnan University of Economics and Law

Wuhan, China

xinkexuxin@gmail.com