Git Product home page Git Product logo

estudy2's Introduction

estudy2

Travis-CI Build Status AppVeyor build status CRAN status CRAN Downloads

Overview

An implementation of a most commonly used event study methodology, including both parametric and nonparametric tests. It contains variety aspects of the rate of return estimation (the core calculation is done in C++), as well as three classical market models: mean adjusted returns, market adjusted returns and single-index market models. There are 6 parametric and 6 nonparametric tests provided, which examine cross-sectional daily abnormal return (see the documentation of the functions for more information). Furthermore, tests for the cumulative abnormal returns are included.

Installation

To install a current stable release from CRAN use:

install.packages("estudy2")

To install the development version of estudy2 use:

# install.packages("devtools")
# library("devtools")
devtools::install_github("irudnyts/estudy2")

Demo

The package is equipped with a demonstration Shiny app that can be run locally with:

library("estudy2")
run_app()

Otherwise, one can explore the deployed version using this link.

estudy2's People

Contributors

irudnyts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

estudy2's Issues

Reporting Statistics

Hi Iegor,

I am using your package for my event sutdy and it is working great. However, I wanted to ask if there are possibilities to report also more statistical properties such as standard errors and such?

At least, I could not figure out how to get them through the package.

Many thanks for your great work.

Error in car_brown_warner_1985 calculation?

Hi Iegor,

hope you are doing well.

I think I have spotted an error in the car_brown_warner_1985 calculation. In your function, you take the mean of daily brown warner:


function (list_of_returns, car_start, car_end, percentage = 90) 
{
    ...
    car_mean <- **mean**(daily_brown_warner_1985_statistics_tidy[, 
        4], na.rm = TRUE)
    statistic <- sum(daily_brown_warner_1985_statistics_tidy[, 
        5], na.rm = TRUE)/sqrt(nrow(daily_brown_warner_1985_statistics_tidy))
  ...
}

However, with this approach I think (not completely sure though) that you take the average across day t and the average across securities i, leading to the daily average abnormal return in the event window instead of the cumulative average abnormal return across the event window.

When calculating in excel, I get the right results editing your code the following way:


{
    ...
    car_mean <- **sum**(daily_brown_warner_1985_statistics_tidy[, 
        4], na.rm = TRUE)
    statistic <- sum(daily_brown_warner_1985_statistics_tidy[, 
        5], na.rm = TRUE)/sqrt(nrow(daily_brown_warner_1985_statistics_tidy))
  ...
}

Note that in the statistics you actually take the sum function.

Let me know what your thoughts are on this.

Kind regards

Sample of Events

Hello,

I have cluster/categories of news that I wish to test the significance as a sample. Can you please let me know if it is possible to do such rank test through the package?

Thank you in advance.

Multiple Event Date

Hi Iegor,

I've been playing with this package and it's really great - thank you for coming up with it. After some research, the only thing I was not able to understand how to do was adding multiple event dates and perform the analysis using the same number of days for the estimation period. Is there any way to use the same market index, the same estimation period, the same event window but use different stocks and different event dates for each stock? I would really appreciate your help.
Cheers!

Fix documentation

  • Fix brown_warner_1985() help page. The test takes into account a cross-sectional dependence.
  • Elaborate on the meaning of weekday, percentage, and mean of returning data frames
  • Fix car_brown_warner1985() help page. Looks like duplication of Lamb test.

Converting CSV of results into S3:returns object for statistical tests

Hi!,

Thanks for getting back to my email. As requested, I'm replying with my issue on here.

I have coded up a FamaFrench model on Python which is working, and I'd like to use the results in R and apply statistical tests to them from estudy2. I understand I need to create an object similar to that returned by the apply_market_model() function (ie, a list object with at least dates, normal, abnormal and predicted returns).

My question is this: How can I import the results into R (e.g. from a csv) and reformat them so that they are suitable to be passed to the parametric and non-parametric statistical tests?

I've attached some sample data (random) in the format I can export the CSVs in.

EDIT: I've got to the point where I can import all the relevant CSVs into R and reformat them as per the picture below, but the parametric/nonparametric test throws this error: Error in if (list_of_returns[[i]]$estimation_end >= event_start) { :
argument is of length zero
--> I guess I need to reformat the data so the function knows how to deal with it. Any help greatly appreciated!

Thanks,
Will

ISIN3.csv
ISIN2.csv
ISIN1.csv

Screenshot of my object that is trying to mimic the S3 object returned by apply_market_model
image

s3 class returns for Non Parametric Tests

Hello,

I wish to carry out non parametric tests but I am not able to generate class returns from my data. I wish to use autogression for abnormal return which will later be tested on the non parametric tests for significance. I tried the single_return code in the documentation but it is also not recognised as a class returns.

Incorrect column name in CAR statistics results df: car_mean

When calculating the car_mean in car_parametric_tests, only the mean of the ARs are calculated - there is no cumulative summation.

e.g., for the calculation of car_mean in the car_lamb process, in car_parametric.R :
car_mean <- mean(daily_lamb_statistics_tidy[, 4], na.rm = TRUE)

This takes the ARs from daily_lamb_statistics_tidy and calculates the mean.
There is no accumulation of the ARs prior to calculating the mean, and therefore it is not a cumulative average abnormal return.

Thus all that is provided is the longitudinal mean of ARs. These ARs are already the cross-sectional averages (which is correct - might be clearer to change the name to AARs as is typical in literature i.e. Average Abnormal Returns).
Thus it would be more useful to provide the CAAR (Cumulative Average Abnormal Return) by calculating it as:
caar <- sum(daily_lamb_statistics_tidy[, 4], na.rm = TRUE)

`car_lamb()` not working for regrouped `apply_market_model()` results

Hi Mr Rudnytskyi,
I hope you are well.

I am a master's student at UCT in South Africa, and am making use of your package estudy2 for a large part of my analysis for my dissertation.
Thank you for providing the package!

Please could you assist me with a problem I am finding with the car_lamb() testing function.

I have a fairly large dataset of equity prices.
I run your package process (as illustrated in the vignette), and record the results of apply_market_models(). I then take these returns objects and reorganise copies into the four different levels of ICB Industry classifications (in descending order; industry, supersector, sector, subsector).

Then I run the all tests on these new groupings, namely
parametric_tests(), nonparametric_tests(), car_parametric_tests(), car_nonparametric_tests().
This functions without error on the larger groupings (i.e. Industry & Supergroup).

However, when I attempt to apply car_parametric_tests() on the smaller groupings, the car_lamb() function runs into the following error:

Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 5, 4 In addition: Warning message: In '/.default' (event_means, sd) : longer object length is not a multiple of shorter object length

Despite my best efforts, I have not discovered why this does not work with the smaller groupings. This error is exactly the same for each subgrouping that throws it.

I need to demonstrate that this is something to do with the smaller groupings, and not the data since the same data and the same market models are used in each grouping.

P.S. I skip every group that is less than or equal to 2 in size.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.