Skip to content

Commit fac3690

Browse files
committed
sens doc round 1
1 parent b5f0894 commit fac3690

File tree

3 files changed

+60
-5
lines changed

3 files changed

+60
-5
lines changed

R/ei_sens.R

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
11
#' Conduct a sensitivity analysis for estimated ecological quantities
22
#'
3+
#' Relates confounding of an omitted variable with predictor or outcome to
4+
#' bias in ecological estimates, using the nonparametric sensitivity analysis
5+
#' of Chernozhukov et al. (2022).
6+
#'
7+
#' The parameter `c_predictor` equals \eqn{1 - R^2_{\alpha\sim\alpha_s}}, where
8+
#' \eqn{\alpha} is the true Riesz representer and \eqn{\alpha_s} is the Riesz
9+
#' representer with the observed covariates. The RR can be equivalently
10+
#' expressed as \deqn{
11+
#' \alpha = \partial_x \log f(X\mid Z, U),
12+
#' } where \eqn{U} is the unobserved confounder and \eqn{f} is the conditional
13+
#' density. The corresponding `c_predictor` is then \deqn{
14+
#' 1 - R^2_{\alpha\sim\alpha_s} = 1 - \
15+
#' \frac{\mathbb{E}[(\partial_x \log f(X\mid Z))^2]}{
16+
#' \mathbb{E}[(\partial_x \log f(X\mid Z, U))^2]}.
17+
#' } When \eqn{X\mid Z,U} and \eqn{X\mid Z} are homoscedastic Gaussian, this
18+
#' simplifies to \deqn{
19+
#' 1 - R^2_{\alpha\sim\alpha_s} =
20+
#' 1 - \frac{\mathbb{E}[X - \mathbb{E}[X\mid Z, U]]^2}{
21+
#' \mathbb{E}[X - \mathbb{E}[X\mid Z]]^2}
22+
#' = R^2_{X\sim U\mid Z}.
23+
#' }
24+
#'
325
#' The bounds here are plug-in estimates and do not incorporate sampling
426
#' uncertainty. As such, they may fail to cover the true value in finite
527
#' samples, even under large enough sensitivity parameters; see Section 5 of
6-
#' Chernozhukov et al (2022).
28+
#' Chernozhukov et al. (2022).
729
#'
830
#' @param est A set of estimates from [ei_est()] using both regression and Riesz
931
#' representer.
@@ -19,7 +41,7 @@
1941
#' @param bias_bound If provided, overrides `c_predictor` and finds values of
2042
#' `c_predictor` that correspond to (the absolute value of) the provided
2143
#' amount of bias.
22-
#' @param confounding The confounding parameter (\eqn{rho}), which must be
44+
#' @param confounding The confounding parameter (\eqn{\rho}), which must be
2345
#' between 0 and 1 (the adversarial worst-case).
2446
#' @param expand_ci If `TRUE` and confidence intervals are present in `est`,
2547
#' expand the width of the intervals in each direction by the calculated bias
@@ -116,6 +138,11 @@ ei_sens <- function(est, c_outcome=seq(0, 1, 0.01)^2, c_predictor=seq(0, 1, 0.01
116138
#' @returns A data frame of the same format as `est`, but with a new `rv` column
117139
#' containing the robustness values.
118140
#'
141+
#' @references
142+
#' Chernozhukov, V., Cinelli, C., Newey, W., Sharma, A., & Syrgkanis, V. (2022).
143+
#' *Long story short: Omitted variable bias in causal machine learning*
144+
#' (No. w30302). National Bureau of Economic Research.
145+
#'
119146
#' @examples
120147
#' data(elec_1968)
121148
#'

man/ei_sens.Rd

Lines changed: 25 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/ei_sens_rv.Rd

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)