Event Study using R
//////////////////////////////////////
One example: testing the impact of HSIC added to the S&P500 on March 18, 2015. 
  
 The basic idea for Event Study is to test whether our AR (Abnormal Return) is 
     statistically significant. The definition of abnormal return is given below. 

           AP=realized return-expected return         (1)

  To estimate our expected return, we apply the following linear regression. 

	y = alpha + beta* x                           (2)

   where, y is the expected return and x is the market return on that day. 
      To estimate two parameters, a and  , we run a linear regression or apply 
      related formulae by choosing an evaluation period of 252-day long, 
      starting the day before our event window counting backward, see below. 
             
             Estimation period                          Event-window
    |-------------------------------|-------------|----------|
	                   n days before      event-day   m-day after
 Here is the design. 
     i) The event day is 3/18/2015			
    ii) Our event window: 10 days before and 10 days after			
   iii) The estimation period: from 253 days before to one-day before our event window

 Thus, roughly we could download daily data from 2/1/2014 to 4/22/2015.
   Step 1: download daily price data from HSIC and S&P500 (^GSPC). 
   Step 2: Choose only adjusted price, see the left panel below.
             Then sort data from oldest to the latest, see the right panel below. 			
   Step 3: estimate daily returns, see the formula in D3.  				
   Step 4: Highlight our event day, a window around the event and the estimation period 
             For example, we could use red color for event day, 10-day before and 
             10-day after our event day. In addition, we could highlight our 
             estimation period green. 
   Step 5: Based on the estimation period, apply following formulae to estimate 
             intercept, slope, R2 and standard error				
             assume B column is for stock returns, C column is S&P500 returns
	    i) intercept      =intercept(B,C)
           ii) slope          =slope    (B,C)
          iii) R2             =rsq      (B,C)
           iv) standard error =steyx    (B,C)

    Step 6: Estimate, expected return, AR (abnormal return), 
            CAP (cumulative abnormal return) and T-AP (T-value for abnormal return)				

         Expected return            AP      CAR     T-value for AR
	  --------------            --      ---     --------------
	Expected return                        = intercept + slope * market			
	AR (abnormal return)                   = realized return   expected return			
	CAR (cumulative abnormal return)       = sum of all ARs up to today			
	T-value for AR                         = AR/standard error			

   Note: to make our spread sheet clean, we have two choices:
 	i) Hide many rows			
	ii) Copy above four output values to a place near our event window			

   Comment on your results. 			

//////////////////////////////////////