Skip to content

Commit

Permalink
r journal resubmit
Browse files Browse the repository at this point in the history
  • Loading branch information
zmjones committed May 11, 2018
1 parent 87ef92d commit c713eda
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 18 deletions.
Binary file modified paper/joint.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 19 additions & 7 deletions paper/jones.R
Expand Up @@ -42,14 +42,16 @@ ggplot(mp.int[fun == "variance"], aes(Petal.Width, Petal.Length)) +
ggsave("mp_int_var.png", width = 8, height = 4)

## marginalization example
mp = function(n, sigma, f) {
mp = function(n, sigma, f, ...) {
aggregate.fun = function(x, w) {
mu = weighted.mean(x, w)
sigma = (sum(w * x^2) * sum(w) - sum(w * x)^2) / (sum(w)^2 - sum(w^2))
list(
"mean" = mu,
"lower" = mu + qnorm(.025) * sigma,
"upper" = mu + qnorm(.975) * sigma)
"upper" = mu + qnorm(.975) * sigma,
"sigma" = sigma
)
}

points = list("X1" = seq(-4, 4, length.out = 100))
Expand All @@ -58,7 +60,7 @@ mp = function(n, sigma, f) {
p.marginal = function(design, data, sigma) dnorm(design$X2)

X = rmvnorm(n, sigma = sigma)
data = data.frame(y = f(NULL, X), X)
data = data.frame(y = f(NULL, data.frame(X)), X)
list(
"joint" = marginalPrediction(data[, c("X1", "X2")], "X1", c(25, n), NULL,
points = points, weight.fun = p.joint, predict.fun = f,
Expand All @@ -72,19 +74,24 @@ mp = function(n, sigma, f) {
n = 10000
sigma.diagonal = diag(2)
sigma.dependent = matrix(c(1, .5, .5, 1), 2, 2)
sigma.het = matrix(c(1, .9, .9, 1), 2, 2)

X = data.frame(rmvnorm(500, sigma = sigma.dependent))
ggplot(X, aes(X1, X2)) +
geom_point()
ggsave("joint.png", width = 7, height = 6)

f.additive = function(object, newdata) as.numeric(as.matrix(newdata) %*% c(1, 1))
f.interaction = function(object, newdata)
as.numeric(as.matrix(data.frame(newdata, newdata[, 1] * newdata[, 2])) %*% c(1, 1, .5))
f.additive = function(object, newdata, theta = c(1, 1))
newdata$X1 * theta[1] + newdata$X2 * theta[2]
f.interaction = function(object, newdata, theta = c(1, 1, .5))
f.additive(object, newdata, theta[1:2]) + newdata$X1 * newdata$X2 * theta[3]
## f.breakit = function(object, newdata)
## f.interaction(object, newdata, c(1, 15, 10))

plt = list(
"additive" = mp(n, sigma.dependent, f.additive),
"interaction" = mp(n, sigma.dependent, f.interaction)
"interaction" = mp(n, sigma.dependent, f.interaction)## ,
## "broken" = mp(n, sigma.het, f.breakit)
)

plt = rbindlist(lapply(plt, rbindlist, idcol = "estimation"), idcol = "sim.type")
Expand All @@ -95,3 +102,8 @@ ggplot(plt, aes(X1, preds.mean, color = estimation)) +
labs(y = expression(f(X[1])), x = expression(X[1])) +
geom_line(aes(X1, X1), linetype = "dashed", color = "black")
ggsave("mvj.png", width = 8, height = 4)

ggplot(plt[estimation == "marginal", ], aes(X1, preds.sigma)) + geom_line() +
facet_wrap(~ sim.type) +
labs(y = expression(var(f(X[1]))), x = expression(X[1]))
ggsave("mvv.png", width = 8, height = 4)
144 changes: 144 additions & 0 deletions paper/jones.bib
Expand Up @@ -111,3 +111,147 @@ @article{jones2016
Forests},
journal = {The Journal of Open Source Software}
}

@article{metropolis1949monte,
title = {The monte carlo method},
author = {Metropolis, Nicholas and Ulam, Stanislaw},
journal = {Journal of the American statistical association},
volume = 44,
number = 247,
pages = {335--341},
year = 1949,
publisher = {Taylor \& Francis Group}
}

@incollection{hammersley1964general,
title = {General principles of the Monte Carlo method},
author = {Hammersley, John Michael and Handscomb, David
Christopher},
booktitle = {Monte Carlo Methods},
pages = {50--75},
year = 1964,
publisher = {Springer}
}

@article{athey2015machine,
title={Machine learning methods for estimating heterogeneous causal effects},
author={Athey, Susan and Imbens, Guido W},
journal={stat},
volume={1050},
number={5},
year={2015}
}

@article{wager2017estimation,
title={Estimation and inference of heterogeneous treatment effects using random forests},
author={Wager, Stefan and Athey, Susan},
journal={Journal of the American Statistical Association},
number={just-accepted},
year={2017},
publisher={Taylor \& Francis}
}

@inproceedings{athey2015machine,
title={Machine learning and causal inference for policy evaluation},
author={Athey, Susan},
booktitle={Proceedings of the 21th ACM SIGKDD international conference on knowledge discovery and data mining},
pages={5--6},
year={2015},
organization={ACM}
}

@article{mullainathan2017machine,
title={Machine learning: an applied econometric approach},
author={Mullainathan, Sendhil and Spiess, Jann},
journal={Journal of Economic Perspectives},
volume={31},
number={2},
pages={87--106},
year={2017}
}

@article{athey2016recursive,
title={Recursive partitioning for heterogeneous causal effects},
author={Athey, Susan and Imbens, Guido},
journal={Proceedings of the National Academy of Sciences},
volume={113},
number={27},
pages={7353--7360},
year={2016},
publisher={National Acad Sciences}
}

@article{athey2017state,
title={The state of applied econometrics: Causality and policy evaluation},
author={Athey, Susan and Imbens, Guido W},
journal={Journal of Economic Perspectives},
volume={31},
number={2},
pages={3--32},
year={2017}
}


@article{LupuJones,
title = {Is There More Violence in the Middle?},
author = {Lupu, Yonatan and Jones, Zachary M.},
journal = {American Journal of Political Science},
year = 2018
}

@article{hill2014empirical,
title = {An Empirical Evaluation of Explanations for State
Repression},
author = {Hill, Daniel W and Jones, Zachary M},
journal = {American Political Science Review},
volume = 108,
number = 03,
pages = {661--687},
year = 2014,
publisher = {Cambridge Univ Press}
}

@article{doi:10.1162/003465304323023651,
author = { Guido W. Imbens },
title = {Nonparametric Estimation of Average Treatment Effects Under Exogeneity: A Review},
journal = {The Review of Economics and Statistics},
volume = {86},
number = {1},
pages = {4-29},
year = {2004},
doi = {10.1162/003465304323023651},

URL = {
https://doi.org/10.1162/003465304323023651
},
eprint = {
https://doi.org/10.1162/003465304323023651
}
,
abstract = { Recently there has been a surge in econometric work focusing on estimating average treatment effects under various sets of assumptions. One strand of this literature has developed methods for estimating average treatment effects for a binary treatment under assumptions variously described as exogeneity, unconfoundedness, or selection on observables. The implication of these assumptions is that systematic (for example, average or distributional) differences in outcomes between treated and control units with the same values for the covariates are attributable to the treatment. Recent analysis has considered estimation and inference for average treatment effects under weaker assumptions than typical of the earlier literature by avoiding distributional and functional-form assumptions. Various methods of semiparametric estimation have been proposed, including estimating the unknown regression functions, matching, methods using the propensity score such as weighting and blocking, and combinations of these approaches. In this paper I review the state of this literature and discuss some of its unanswered questions, focusing in particular on the practical implementation of these methods, the plausibility of this exogeneity assumption in economic applications, the relative performance of the various semiparametric estimators when the key assumptions (unconfoundedness and overlap) are satisfied, alternative estimands such as quantile treatment effects, and alternate methods such as Bayesian inference. }
}


@article{berk2009forecasting,
title={Forecasting murder within a population of probationers and parolees: a high stakes application of statistical learning},
author={Berk, Richard and Sherman, Lawrence and Barnes, Geoffrey and Kurtz, Ellen and Ahlman, Lindsay},
journal={Journal of the Royal Statistical Society: Series A (Statistics in Society)},
volume={172},
number={1},
pages={191--211},
year={2009},
publisher={Wiley Online Library}
}

@article{blair2017predicting,
title={Predicting local violence: Evidence from a panel survey in Liberia},
author={Blair, Robert A and Blattman, Christopher and Hartman, Alexandra},
journal={Journal of Peace Research},
volume={54},
number={2},
pages={298--312},
year={2017},
publisher={SAGE Publications Sage UK: London, England}
}
Binary file modified paper/jones.pdf
Binary file not shown.

0 comments on commit c713eda

Please sign in to comment.