Skip to content

Commit

Permalink
Address review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
swager committed Aug 25, 2019
1 parent f6cf732 commit c34f3b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions r-package/grf/R/average_late.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
#' overall ATE is 0.5 (not 0.05).
#'
#' @param forest The trained forest.
#' @param compliance.score An estimate of the causal effect of Z on W, for
#' each sample i = 1, ..., n.
#' @param compliance.score An estimate of the causal effect of Z on W,
#' i.e., Delta(X) = E[W | X, Z = 1] - E[W | X, Z = 0],
#' for each sample i = 1, ..., n.
#' @param subset Specifies subset of the training examples over which we
#' estimate the ATE. WARNING: For valid statistical performance,
#' the subset should be defined only using features Xi, not using
#' the treatment Wi or the outcome Yi.
#' the instrument Zi, treatment Wi or outcome Yi.
#'
#' @references Aronow, Peter M., and Allison Carnegie. "Beyond LATE: Estimation
#' of the average treatment effect with an instrumental variable." Political
Expand Down Expand Up @@ -115,15 +116,15 @@ average_late <- function(forest,
"Estimated treatment propensities take values between ",
round(rng[1], 3), " and ", round(rng[2], 3),
" and in particular get very close to 0 or 1. ",
"Poor overlap may hurt perfmance for average conditional local average",
"Poor overlap may hurt perfmance for average conditional local average ",
"treatment effect estimation."
))
}

if (min(subset.compliance.score) <= 0.01 * sd(subset.W.orig)) {
warning(paste0(
"The instrument appears to be weak, with some compliance scores as",
"low as", round(min(subset.compliance.score), 4)
"The instrument appears to be weak, with some compliance scores as ",
"low as ", round(min(subset.compliance.score), 4)
))
}

Expand Down
3 changes: 2 additions & 1 deletion r-package/grf/tests/testthat/test_average_effect.R
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,5 @@ test_that("average conditional local average treatment effect estimation is reas

expect_equal(as.numeric(tau.x1p["estimate"]), mean(tau[X[,1] > 0]), tol = 0.3)
expect_lt(abs(tau.x1p["estimate"] - mean(tau[X[,1] > 0])) / tau.x1p["std.err"], 3)
})
})

0 comments on commit c34f3b7

Please sign in to comment.