Giter VIP home page Giter VIP logo

jvpoulos / homesteads Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 1.0 182.79 MB

Replication code for "State-Building through Public Land Disposal? An Application of Matrix Completion for Counterfactual Prediction"

Home Page: https://www.tandfonline.com/doi/full/10.1080/2330443X.2024.2356514

License: MIT License

R 99.83% Shell 0.17%
causal-inference matrix-completion panel-data randomization-test political-economy synthetic-control

homesteads's Introduction

homesteads

This repository provides data and code for reproducing "State-Building through Public Land Disposal? An Application of Matrix Completion for Counterfactual Prediction".

Please cite the paper if you use this code for academic research:

@article{doi:10.1080/2330443X.2024.2356514,
        author = {Jason Poulos},
        title = {State-Building through Public Land Disposal? An Application of Matrix Completion for Counterfactual Prediction},
        journal = {Statistics and Public Policy},
        year = {2024},
        pages = {1--21},
        publisher = {Taylor \& Francis},
        doi = {10.1080/2330443X.2024.2356514},
        URL = {https://doi.org/10.1080/2330443X.2024.2356514},
        eprint = {https://doi.org/10.1080/2330443X.2024.2356514}
}

Prerequsites

  • R (tested on 4.0.1)
  • Required packages located in package-list.R
    • The packages libgdal-dev and libproj-dev are required prior to installing the rgdal R package:
$ sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev
  • The package mdbtools is required prior for the mdb.get function of the HMisc R package:
$ sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev

Install the forked MCPanel repo:

install.packages("devtools")
library(devtools) 
install_github("jvpoulos/MCPanel")

Note: fitting the matrix completion model with covariates (mcnnm_wc_cv) is computationally expensive and will likely make a laptop crash. The code below is run on a single node with 30G RAM and 6 CPU-cores on a high-performance compute cluster.

Instructions for data assembly

  • Clone a copy of the repository to your working directory with the command
$ git clone https://github.com/jvpoulos/homesteads
  • Download and extract patents data (2.8 GB uncompressed) to data/ directory:

  • Make shell file code/main.sh executable from the Linux/Unix command line:

$ chmod +x code/main.sh
  • Execute the file:
$ ./code/main.sh > main.txt

Run order for experiments and causal estimates

  1. For simulated data experiments, run with command line argument Rscript code/mc-simulation.R [arg1], where [arg1] is a number specifying the estimator and simulation setting
  • set flag doMPI to FALSE to run serially
  • code/mc-simulation-plot.R # plot results for simulated data experiments
  1. Repeat the last step for code/mc-synth.R, code/mc-capacity.R, and code/mc-simulation.R to run experiments on synthetic control, state government finance datasets, and simulated data, resp.
  • set flag doMPI to FALSE to run serially
  • code/mc-synth-simulation-plot.R, code/mc-capacity-simulation-plot.R, and code/mc-simulation-plot.R to plot results
  1. For MC placebo estimates on state government finances: Rscript code/mc-capacity-placebo.R [arg1], where [arg1] is a number specifying the estimator and outcome of interest
  • set flag doMPI to FALSE to run serially
  1. For causal estimates on state government finances via MC and comparison estimators: Rscript code/mc-capacity-estimates.R [arg1], where [arg1] is a number specifying the estimator and outcome of interest
  • code/mc-capacity-plots.R # to plot results
  1. For causal estimates on state government finances and land inequality via continuous treatment DID: Rscript code/dd-capacity.R [arg1], where [arg1] is a number specifying the imputation method, and Rscript code/dd-inequality.R

homesteads's People

Contributors

jvpoulos avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

zhangc927

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.