Giter Club home page Giter Club logo

competitor-scale's Introduction

Materials for reproducing Jakab (2018), *Competitor Scale and Mutual Fund Behavior*. If you have questions, contact the [author]([email protected]). 


## Setup

Built under `R 3.4.3`. The following packages are used.
- `bookdown` (v. 0.7)
- `broom` (v. 0.4.3)
- `compsizer` (install using `devtools::install_github(laszlo-jakab/compsizer)`)
- `data.table` (v. 1.10.4-3)
- `doParallel` (v. 1.0.11)
- `foreach` (v. 1.4.4)
- `FredR` (install using `devtools::install_github("jcizel/FredR")`)
- `ggplot2` (v. 2.2.1)
- `gridExtra` (v. 2.3)
- `knitr` (v. 1.19)
- `laszlor` (install using `devtools::install_github("laszlo-jakab/laszlor")`)
- `lfe` (v. 2.6-2291)
- `lubridate` (v. 1.7.2)
- `magrittr` (v. 1.5)
- `rio` (v. 0.5.9)
- `rJava` (v. 0.9-9)
- `RJDBC` (v. 0.2-7)
- `xtable` (v. 1.8-2)
- `zoo` (v. 1.8-1)

Note that the `.Rprofile` file in the root loads `data.table` and `zoo`, as these packages are used throughout the project.

## Contents

### `R/`: Code

0. `Initialize_Folders.R`: Create folders for housing data and results.

1. `data_acquisition/`: Download data from the web.
    - `Pull_WRDS_Data.R`: Download data directly from WRDS using `R`'s interface. You need a WRDS subscription for this step. Follow the WRDS instructions for setting up `R` access (you need to download the appropriate .jar files for instance). The script downloads some datasets not necessary for recreating the paper.
    - `Other_Web_Data.R`: Download data from other sources on the web, such as active share, CPI, etc. The script downloads some datasets not used in the paper.

2. `data_wrangling/`: Prepare the data for analysis. Run in sequence.
    - `1-Clean.R`: Clean downloaded raw data.
    - `2-Benchmark_Returns.R`: Calculate factor-adjusted excess returns.
    - `3-Portfolio_Weights.R`: Calculate fund portfolio weights.
    - `4-Identify_Active_Funds.R`: Implement filters for identifying actively managed domestic equity funds.
    - `5-CompetitorSize.R`: Calculate *CompetitorSize* measure
    - `6-Dln_CompetitorSize.R`: Calculate quarter-end-to-quarter-end changes in log *CompetitorSize*, holding fund similarity constant.
    - `7-Portfolio_Liquidity.R`: Calculate portfolio liquidity and its sub-components.
    - `8-Portfolio_Groups.R`: Group funds into ten groups based on k-means clustering of portfolio weights.
    - `9-Combine_Data.R`: Combine dataset.
    - `scandal/`: Prepare the dataset used in the scandal analysis.
        - `1-ScandalExposure.R`: Calculate *ScandalExposure*.
        - `2-ScandalOutFlow.R`: Calculate *ScandalOutFlow*.
        - `3-Scandal_Analysis_Data.R` Combine dataset used in scandal analysis.
 
3. `analysis/summary/`: Descriptive statistics.
    - `Summary_Tables.R`: Tables of summary statistics and correlations.
    - `Summary_Plots.R`: Descriptive figures.
        - *CompetitorSize* time series, histograms.
        - Thomson report dates.
        - Data availability in CRSP.
    - `Scandal_Tables.R`: Tables of summary statistics related to the 2003 mutual fund scandal.
        - Snapshot of fund characteristics as of Aug 2003 by scandal status.
        - Snapshot of fund characteristics as of Aug 2003 by scandal exposure.
    - `Scandal_Plots.R`: Figures related to the scandal.
        - Flows by scandal status, fraction of industry affected.
        - *ScandalOutFlow* characteristics
        - Time series of untainted fund outcomes by scandal exposure, mean scandal outflow

4. `analysis/regs/`: Regressions.
    - `Behavior_Regs.R`: Regressions of changes in capital allocation decisions on changes in competitor scale.
    - `Scandal_Regs.R`: Regressions using the 2003 mutual fund scandal as a quasi-exogenous shock to competitor scale.
    - `Returns_Regs.R`: Within-fund regressions of risk-adjusted returns on competitor scale.
    - `Flow_Regs.R`: Regressions using net flows as the dependent variable.

### `data/`: Data used in analysis

- `scandal/scandal_wficns_2018-Mar-06.Rds`: File containing categorization of funds by scandal status. Categorization done manually based on Aug 2003 fund names. This is the only piece of data generated outside of the code in the `R/` folder.  

### `thesis/`: Files to generate pdf document.

- `render_book.R`: Compiles the document.
- `preamble.tex`: Additional tex in the preamble.
- `index.Rmd`: Front matter.
- `01-intro.Rmd`-`07-conclusion.Rmd`: Main body.
- `appendix-01-summary.Rmd`-`appendix-04-scandal.Rmd`: Appendices.
- `ref-toc.Rmd`: Make sure references show up in toc.
- `mf-references.bib`: Bibliography file.
- `_bookdown.yml`, `_output.yml`: Options for rendering the document.
- `ucetd.cls`: Latex class file to conform to UofC formatting requirements. 

### `packrat`

Files generated by `packrat` for package management.

competitor-scale's People

Contributors

laszlo-jakab avatar

Watchers

 avatar  avatar

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.