- Read the book chapter Accessing & managing financial data entirely. It may contain some advanced concepts but also a description of almost every important dataset relevant for research in empirical finance.
- Consult the material on Absalon on how to get the raw CRSP data as a KU student. Download the data and follow the cleaning steps described in the lecture slides.
- Download the file
tidy_finance.sqlitefrom Absalon. Optimally you store it in a folder called
datawithin your standard working directory for the course. Almost all exercises from now on will start with reading data out of this file, so make sure you familiarize yourself with this short minimal setup to load data into your R session memory from a fresh session (you can consult it anytime again later during the course)
From now on, all you need to do to access data that is stored in the database is to follow three steps: (i) Establish the connection to the SQLite database, (ii) call the table you want to extract, and (iii) collect the data. For your convenience, the following steps show all you need in a compact fashion.
library(tidyverse) library(RSQLite) tidy_finance <- dbConnect(SQLite(), “data/tidy_finance.sqlite”, extended_types = TRUE) factors_q_monthly <- tbl(tidy_finance, “factors_q_monthly”) factors_q_monthly <- factors_q_monthly %>% collect()
- As always (but this is really important): If you have trouble with the SQL database, post your question on Absalon. Malte, your peers and I will help you!
- Replicate the following two figures provided in the lecture slides: i) Create a time-series of the number of stocks in the CRSP sample which are listed on NASDAQ, NYSE and AMEX. ii) Illustrate the time series of total market values (inflation adjusted) based on industry classification
siccd. The book Empirical Asset Pricing (Bali, Murrey and Engle) provides a precise walk-through if you need help.
- Follow the procedure described in Chapter 7.2 of the book Empirical Asset Pricing to compute returns adjusted for delisting for the CRSP sample.
Solutions: All solutions are provided in the book chapter Accessing & managing financial data and the lecture slides