Create a PostgreSQL database with loan-level data from Fannie Mae and Freddie Mac
December 25, 2017 ยท View on GitHub
Scripts used in support of this post: Mortgages Are About Math: Open-Source Loan-Level Analysis of Fannie and Freddie
Usage
- Make sure you have PostgreSQL installed locally. If you want to use R, install it too
- Download data from Fannie Mae and/or Freddie Mac and unzip all files into the
data/fannie/anddata/freddie/subdirectories ./initialize_database.shcreates a Postgres database calledagency-loan-level, creates some tables, and imports supporting data including FHFA home price data and Freddie Mac mortgage rate data./load_fannie_loans.shand./load_freddie_loans.shimport data for Fannie and Freddie, respectively. This might take a very long time (~2 days), so you could consider loading the data in chunks
Analysis
The analysis/ folder has additional SQL and R scripts used to analyze the data, see more in the full post