This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(magrittr) | |
library(purrr) | |
library(gtools) | |
## Estimand function and estimator function | |
tau.fn <- function(science) mean(science$y1) - mean(science$y0) | |
hat.tau.fn <- function(w, y) mean(y[w==1]) - mean(y[w==0]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A better way uses the gridExtra package. This is mostly for future reference, in case gridExtra doesn't | |
handle a specific case. | |
""" | |
# Stacking plots in a grid | |
stack_plots <- function(gs, nrow, ncol, fout=NULL, add_opts){ | |
# example: stack_plots(list(g1, g2, g3), 2, 2, function (x) opts(legend.position="bottom")) | |
if(length(fout) > 0){ |