Code Monkey home page Code Monkey logo

angrist-krueger-1991's Introduction

Replicate MHE Table 4.1.1 and Figure 4.1.1

Build Status lifecycle lifecycle

What this repo does

We replicate Table 4.1.1 and Figure 4.1.1 from Mostly Harmless Econometrics using a reproducible research workflow.

Our weapons of choice are:

  • Snakemake to manage the build and dependencies
  • R for statistical analysis

How to Build this repo

If you have Snakemake and R installed, navigate your terminal to this directory.

Installing Missing R packages

To ensure all R libraries are installed, type

snakemake install_packages

into a your terminal and press RETURN.

If you modify the packages used in this repo, you should rerun this command to store package updates in the REQUIREMENTS.txt.

Building the Output

Type:

snakemake all

into a your terminal and press RETURN

See HELP.txt for explanation of what the Snakemake Rules are doing.

Install instructions

Installing R

  • Install the latest version of R by following the instructions here.
    • You can ignore the RStudio instructions for the purpose of this project.

Installing Snakemake

This project uses Snakemake to execute our research workflow. You can install snakemake as follows:

  • Install Snakemake from the command line (needs pip, and Python)

    pip install snakemake
    
    • If you haven't got Python installed click here for instructions
  • Windows and old Mac OSX users: you may need to manually install the datrie package if you are getting errors. Using conda, this seems to work best:

    conda install datrie
    

Installing pandoc and LaTeX

Because we want to generate pdf outputs we need two additional bits of software to make that happen:

  • If you do not have RStudio installed, you will have to install Pandoc (http://pandoc.org)
  • If you do not have LaTeX installed, we recommend that you install TinyTeX (https://yihui.name/tinytex/)
    • TinyTeX is a lightweight, portable, cross-platform, and easy-to-maintain LaTeX distribution.
    • From inside R:
      install.packages('tinytex')
      tinytex::install_tinytex()  # install TinyTeX
      

Visualization of the Workflow

Snakemake workflows are a directed acyclic graph (DAG). We can visualize the relationship between the rules (a simplified view of the DAG) in our workflow:

Rulegraph for MRW Workflow

Check out the rules in for various visualizations of the workflow near the bottom of the Snakefile in the 'Snakemake Workflow graphs'. You will need to install graphviz to run these rules - we have included a rule inside dag.smk to install this for you.

Updates to Workflow Example

Periodic updates the workflow occur as I find better/simpler ways to do things and as my opinions on best practice evolve. Major changes are tracked in the NEWS file with brief descriptions of the changes implemented.

Comments / Suggestions / Issues

I'd love to hear your comments, suggestions or installation issues encountered when running the example. Post an issue on Github.

Suggested Citation:

Deer, Lachlan, 2020. "Replication of Angrist and Krueger (1991) with Snakemake : Table 4.1.1 and Figure 4.1.1 from Mostly Harmless Econometrics.

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.