Skip to content
Replication code for "RNN-based counterfactual prediction"
R Python Shell
Branch: master
Clone or download
Latest commit d62d266 Oct 1, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Oct 2, 2017


This repository provides data and code for reproducing "RNN-based counterfactual prediction".

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

       author = {{Poulos}, Jason},
        title = "{RNN-based counterfactual prediction}",
      journal = {arXiv e-prints},
     keywords = {Statistics - Machine Learning, Economics - Econometrics, Statistics - Applications},
         year = "2017",
        month = "Dec",
          eid = {arXiv:1712.03553},
        pages = {arXiv:1712.03553},
archivePrefix = {arXiv},
       eprint = {1712.03553},
 primaryClass = {stat.ML},
       adsurl = {},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}


  • Python 2 (tested on Python 2.7.16)

  • Tensorflow 1.2

  • R version 3.5.2 (2018-12-20).

Set up

  • Clone a copy of the repository to your working directory with the command
$ git clone
  • In R, install MCPanel from the forked repo:
  • Open package-list.R in a script editor

    • Verify that all required packages in package-list.R are installed in your R library
  • Make shell file executable from the Linux/Unix command line:

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


To run placebo experiments, repeat the last two steps for

  • synthetic control datasets
  • stock market prices
  • state government finances

Counterfactual predictions

To get encoder-decoder estimates run <GPU_ID> <epochs> <batches> <data name> <t_0> <T> <imputation_method>; e.g.,

python 0 1000 8 'educ' 87 156 'locf'

Similarly, for RVAE estimates run <GPU ID> <epochs> <batches> <data name> <t_0> <T> <imputation_method>; e.g.,

python 0 1000 8 'educ' 87 156 'locf'

To plot the training and validation error, run <file location of training log>; e.g.,

python '../results/rvae/educ/training_log_educ.csv'
You can’t perform that action at this time.