Event Studies Package for CRSP
Project description
Python Event Studies
Python package for conducting event studies over the CRSP database. Enable easy studies with standards methodologies but also implements the one in the paper .
The package do not contains the data, you need to download the data from CRSP.
To install the package use the following command:
pip install py_event_studies
In order to use the package, here is how you can use it:
import py_event_studies as pes
# Load the data (supports csv or parquet files)
# This step will take a little bit of time as it will not only load the data but also preprocess it by pivoting the table in order to be more efficient afterwards.
# It will save a cache file so if you reload the same path it will use the cache. If you changed the data pass the argument no_cache=True
pes.load_data('path/to/your/data.csv')
#If you want to use the Fama-French factors (optional, this step is however very fast as the data is not preprocessed)
pes.load_ff_factors('path/to/your/fama_french_factors.csv')
date = '20120816'
# Get the valid permnos at the date, not needed if you already have a list of permnos
valid_permnos = pes.get_valid_permno_at_date(date)
# Compute the event study for a portfolios
results = pes.compute(date, valid_permnos[np.array([1,10,50,23,35, 102, 55, 66, 548,1002])])
# Display the results statistics for standard tests, also available: cs_test_stats (cross sectionnal), bmp_test_stats (Boehmer, Musumeci and Poulsen (1991)), kp_test_stats (Kolari & Pynnönen (2010))
display(results.std_test_stats)
# In order to plot the prediction made by one of the model for a given cluster size (specify one even if it's a model that do not use one as here)
results.plot(5, 'FF5')
# Summary methods will print results of all tests for all models and all cluster sizes
results.summary()
# Finally you can save the results to an excel file with all results and statistics in different sheets to export it for further analysis
results.to_excel('path_to_save_results.xlsx')
License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py_event_studies-0.2.0.tar.gz
(21.6 kB
view details)
Built Distribution
File details
Details for the file py_event_studies-0.2.0.tar.gz
.
File metadata
- Download URL: py_event_studies-0.2.0.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28aa09978b80aa6fc867473cdd5a745fafd5e0ba0be6726d7d7a466ec0841606 |
|
MD5 | 9d771c12171e3ddb9e70486604959861 |
|
BLAKE2b-256 | f1db6779d42cc54b6c8dd067ed2f70bfd8a7ba7a34365cd9614899755ac13f40 |
File details
Details for the file py_event_studies-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: py_event_studies-0.2.0-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9a68f3db80e9eebfb1251355c77a694f7b8c601e6a8c406f8032791fb749dc7 |
|
MD5 | 1128af136e78d5e638c86fc3bf53a836 |
|
BLAKE2b-256 | 42d8f5c496a9e0324f2e5ae0bb2e6b36cb730ecadce43efd8984153d09ca84ea |