Introduction to estudy2

Iegor Rudnytskyi

2019-04-25

Introduction

The estduy2 package is an implementation of an event study methodology. The event study is a statistical toolbox that allows examining the impact of certain events on the stock valuation of companies. The idea of the event study is to compare the market valuation of companies during an event-free period (called the estimation period) and a period when an event happened (the event period).

In order to complete a full event study one has to:

The estudy2 package provides a set of functions to cover these steps. Functions’ names are self-explanatory and functions should be called consecutively in the following order:

The package is designed to work with one of the data types, namely zoo, list, or data.frame depending on user preference.

The purpose of this vignette is to provide a brief introduction of how to use this package. The illustrative example is the analysis of the impact of 9/11 terrorist attacks on World Trading Center on eight European insurance companies.

Obtaining prices of companies’ stocks

We select eight European insurance companies, tickers of which are listed in the code snippet below. The starting and ending date are set to "2000-01-01" and "2002-01-01", respectively, in order to include both the estimation and the event periods. Then, prices of securities should be downloaded. The function get_prices_from_tickers downloads prices for companies’ tickers between start and end date. Under the hood, this function is a wrapper around get.hist.quote from tseries. The function can return either Open or Close quote (quote argument). Also one has to choose the returning class among "list", "zoo", and "data.frame". Further in the vignette we use zoo objects. We download historical prices of companies with:

library(estudy2)
tickers <- c("ALV.DE", "CS.PA", "G.MI", "HNR1.HA", "HSX.L", "MUV2.DE", "RSA.L",
             "TOP.CO")
prices <- get_prices_from_tickers(tickers, 
                                  start = as.Date("2000-01-01"),
                                  end = as.Date("2002-01-01"),
                                  quote = "Close",
                                  retclass = "zoo")

For using a single-index market model we also need to download prices of an index (proxy):

prices_indx <- get_prices_from_tickers("^STOXX50E",
                                       start = as.Date("2000-01-01"),
                                       end = as.Date("2002-01-01"),
                                       quote = "Close",
                                       retclass = "zoo")

Computing rates of returns from prices

Now we need to compute rates of returns form companies’ prices. For this purpose the function get_rates_from_prices is used, which is an S3 generic function dispatched on prices argument allowing for list, zoo, and data.frame (the same classes which get_prices_from_tickers returns). The function computes rates of returns of given prices using either continuous or discrete compounding depending on compounding argument value. Furthermore, setting multi_day to TRUE allows for rates of returns between non-consecutive days (for instance, Friday - Monday rate of return). We calculate rates of returns of companies and the index by:

rates <- get_rates_from_prices(prices,
                               quote = "Close",
                               multi_day = TRUE,
                               compounding = "continuous")

rates_indx <- get_rates_from_prices(prices_indx, 
                                    quote = "Close",
                                    multi_day = TRUE,
                                    compounding = "continuous")

Applying a market model

To calculate expected rates of returns during the event period we need to train a market model based on date from the estimation period. apply_market_model goes over each company (column) in rates and calibrates a chosen model. The function returns a list of S3 returns class objects, which can be passed to parametric_tests and nonparametric_tests. For our case we use the single-index market model:

securities_returns <- apply_market_model(
    rates = rates,
    regressor = rates_indx,
    same_regressor_for_all = TRUE,
    market_model = "sim",
    estimation_method = "ols",
    estimation_start = as.Date("2001-03-26"),
    estimation_end = as.Date("2001-09-10")
)

Tests

The event study utilizes both parametric and nonparametric tests. Parametric tests are Brown and Warner (1980), Brown and Warner (1985), t-test, Patell (1976), Boehmer (1991), and Lamb (1995) tests. To avoid calling all these tests separately, one can call parametric_tests with all = TRUE. The same applies to nonparametric tests, i.e. simple binomial sign, binomial sign, Corrado (1992), rank, modified rank, and Wilcoxon signed rank tests can be called all at once by specifying all = TRUE in nonparametric_tests. These tests are also available separately. Both functions return data frames with statistics and significance for each date in the event period. See ?parametric_tests and ?nonparametric_tests for references and more details.

parametric_tests(list_of_returns = securities_returns,
                 event_start = as.Date("2001-09-11"),
                 event_end = as.Date("2001-09-28"))
#>          date   weekday percentage         mean bw_1980_stat
#> 1  2001-09-11   Tuesday        100 -0.070310766  -10.4498488
#> 2  2001-09-12 Wednesday        100 -0.050417895   -7.4932960
#> 3  2001-09-13  Thursday        100  0.004065211    0.6041869
#> 4  2001-09-14    Friday        100 -0.026200595   -3.8940303
#> 5  2001-09-17    Monday        100 -0.004221486   -0.6274130
#> 6  2001-09-18   Tuesday        100 -0.016655690   -2.4754309
#> 7  2001-09-19 Wednesday        100 -0.002715794   -0.4036314
#> 8  2001-09-20  Thursday        100 -0.099439820  -14.7791177
#> 9  2001-09-21    Friday        100 -0.041236146   -6.1286701
#> 10 2001-09-24    Monday        100  0.034900198    5.1869979
#> 11 2001-09-25   Tuesday        100  0.050934143    7.5700227
#> 12 2001-09-26 Wednesday        100  0.017198700    2.5561351
#> 13 2001-09-27  Thursday        100  0.008473701    1.2593931
#> 14 2001-09-28    Friday         75  0.010468462    1.5558620
#>    bw_1980_signif bw_1985_stat bw_1985_signif t_test_stat t_test_signif
#> 1             ***   -9.1377725            ***  -4.6136474           ***
#> 2             ***   -6.5524426            ***  -2.0065633             *
#> 3                    0.5283255                  0.2155208              
#> 4             ***   -3.4050984            ***  -1.0675013              
#> 5                   -0.5486354                 -0.1921879              
#> 6              **   -2.1646174             **  -0.7000980              
#> 7                   -0.3529517                 -0.1467507              
#> 8             ***  -12.9234612            ***  -2.7708264            **
#> 9             ***   -5.3591582            ***  -2.9777583            **
#> 10            ***    4.5357217            ***   1.9554700             *
#> 11            ***    6.6195355            ***   2.7935029            **
#> 12             **    2.2351884             **   2.7453924            **
#> 13                   1.1012645                  0.6376467              
#> 14                   1.3605090                  1.9664812              
#>        pt_stat pt_signif    bh_stat bh_signif    lmb_stat lmb_signif
#> 1  -10.6053649       *** -3.7752115       ***  -8.3398273        ***
#> 2   -6.1876289       *** -1.8307089            -6.4967073        ***
#> 3    1.2386443            0.4542658             0.5245677           
#> 4   -4.2965526       *** -1.1124795            -3.1282615        ***
#> 5    0.6088912            0.1848071            -0.5298223           
#> 6   -2.6380721       *** -0.6385645            -2.1548547         **
#> 7    0.2920221            0.1140339            -0.3463359           
#> 8  -13.9458986       *** -3.1250165        ** -12.3423564        ***
#> 9   -5.8695546       *** -2.7229220        **  -5.2337855        ***
#> 10   4.6916806       ***  1.7003251             4.1355087        ***
#> 11   7.4886553       ***  2.9610826        **   6.5758189        ***
#> 12   2.5761525       ***  3.1156845        **   2.2049847         **
#> 13   1.7777984         *  0.8649207             1.0911784           
#> 14   1.5130808            2.0464470         *   1.3255244

nonparametric_tests(list_of_returns = securities_returns,
                    event_start = as.Date("2001-09-11"),
                    event_end = as.Date("2001-09-28"))
#>          date   weekday percentage  sign_stat sign_signif  gsign_stat
#> 1  2001-09-11   Tuesday        100 -2.8284271         *** -2.78643330
#> 2  2001-09-12 Wednesday        100 -1.4142136             -1.37206152
#> 3  2001-09-13  Thursday        100  0.0000000              0.04231027
#> 4  2001-09-14    Friday        100 -0.7071068             -0.66487562
#> 5  2001-09-17    Monday        100  0.0000000              0.04231027
#> 6  2001-09-18   Tuesday        100  0.0000000              0.04231027
#> 7  2001-09-19 Wednesday        100 -0.7071068             -0.66487562
#> 8  2001-09-20  Thursday        100 -2.8284271         *** -2.78643330
#> 9  2001-09-21    Friday        100 -1.4142136             -1.37206152
#> 10 2001-09-24    Monday        100  2.1213203          **  2.16386794
#> 11 2001-09-25   Tuesday        100  1.4142136              1.45668205
#> 12 2001-09-26 Wednesday        100  2.1213203          **  2.16386794
#> 13 2001-09-27  Thursday        100  0.0000000              0.04231027
#> 14 2001-09-28    Friday         75  1.9051587           *  1.94201360
#>    gsign_signif csign_stat csign_signif    rank_stat rank_signif
#> 1           *** -2.3783843           ** -3.216659912         ***
#> 2               -1.1891922              -1.918951621           *
#> 3                0.0000000               0.186372999            
#> 4               -0.5945961              -0.828324441            
#> 5                0.0000000              -0.269205443            
#> 6                0.5945961               0.110443259            
#> 7               -0.5945961              -0.006902704            
#> 8           *** -2.3783843           ** -3.389227504         ***
#> 9               -1.1891922              -1.981075954          **
#> 10           **  1.7837882            *  2.381432767          **
#> 11               1.1891922               2.001784065          **
#> 12           **  1.7837882            *  2.036297584          **
#> 13               0.0000000               0.676464960            
#> 14            *  0.9154405               1.699599038           *
#>      mrank_stat mrank_signif wlcx_stat wlcx_signif
#> 1  -3.331702615          ***         0         ***
#> 2  -2.010229568           **         4          **
#> 3   0.151071220                     19            
#> 4  -0.842915498                     10            
#> 5  -0.288916538                     16            
#> 6   0.100731573                     16            
#> 7  -0.003276817                     15            
#> 8  -3.522070704          ***         0         ***
#> 9  -2.030098770           **         3          **
#> 10  2.478427843           **        30          **
#> 11  2.067838581           **        31          **
#> 12  2.137908132           **        33          **
#> 13  0.663791033                     22            
#> 14  1.511852212                     24         ***

Using magrittr

One can notice that the result of the previous function is passed to the next function. In order to avoid naming all the intermediate objects or using a function composition, it possible to utilize a power of the pipe operator from magrittr. The above code can be rewritten with:

library(magrittr)

rates_indx <- get_prices_from_tickers("^STOXX50E",
                                      start = as.Date("2000-01-01"),
                                      end = as.Date("2002-01-01"),
                                      quote = "Close",
                                      retclass = "zoo") %>%
    get_rates_from_prices(quote = "Close",
                          multi_day = TRUE,
                          compounding = "continuous")

tickers <- c("ALV.DE", "CS.PA", "G.MI", "HNR1.HA", "HSX.L", "MUV2.DE", "RSA.L",
             "TOP.CO")
nine_eleven_param <- get_prices_from_tickers(tickers,
                                             start = as.Date("2000-01-01"),
                                             end = as.Date("2002-01-01"),
                                             quote = "Close",
                                             retclass = "zoo") %>%
    get_rates_from_prices(quote = "Close",
                          multi_day = TRUE,
                          compounding = "continuous") %>%
    apply_market_model(regressor = rates_indx,
                       same_regressor_for_all = TRUE,
                       market_model = "sim",
                       estimation_method = "ols",
                       estimation_start = as.Date("2001-03-26"),
                       estimation_end = as.Date("2001-09-10")) %>%
    parametric_tests(event_start = as.Date("2001-09-11"),
                     event_end = as.Date("2001-09-28"))