Skip to content

a-torgovitsky/mtw2020mc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mtw2020mc

Repo: https://github.com/a-torgovitsky/mtw2020mc

This package contains the code for the Monte Carlo simulations in "The Causal Interpretation of Two-Stage Least Squares with Multiple Instrumental Variables" by Mogstad, Torgovitsky, and Walters.

Initial prerequisites

  • Gurobi and the Gurobi R package gurobi, which can be obtained from Gurobi Optimization. A Gurobi software license is available at no cost to academic researchers. A clear installation guide for Gurobi can be found here.
  • A LaTeX distribution, such as TeX live. (This is only required to convert figures made in ggplot2 to Tikz. The code in plots.R can be easily adjusted to save the native ggplot2 figures by simply ignoring the function printtikz.)

Install dependencies

First make sure that the gurobi package is installed and install devtools if it isn't already installed:

install.packages("devtools")

Obtain the source files (e.g. clone the repo), then install dependencies from CRAN:

devtools::install_deps(pkg = ".", dependencies = TRUE)

Usage

Figures 1 and 2 in the supplemental appendix can then be replicated as follows:

devtools::load_all()

# Uncomment the following two lines and adjust workers if you want to run in parallel
# library("future")
# plan(multicore, workers = 35)

figure1()
figure2()

This will produce some csv files with data, some tex files for the figures, and some pdf's with compiled figures.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages