| Title: | Robustness Values for Causal Estimation |
|---|---|
| Description: | What the package does (one paragraph). |
| Authors: | Beniamino Green [aut, cre] |
| Maintainer: | Beniamino Green <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.0.0.9000 |
| Built: | 2026-10-16 11:03:31 UTC |
| Source: | https://github.com/beniaminogreen/ivrobustness |
Benchmark Robustness Values Based on Observed Covariates
benchmark_covariates(w, z, y, X)benchmark_covariates(w, z, y, X)
w |
the instrument vector, a numeric (double) vector with no NA values |
z |
the treatment vector, a numeric (double) vector with no NA values |
y |
the outcome vecctor, a numeric (double) vector with no NA values |
X |
a matrix of control covaraites used for benchmarking |
a dataframe containing the robustness values associated with held out covariates
Struggling to interpret the results of robustness_values? Look no further!
interpret_table helps by providing a plain-text interpretation of the robustness
values of a design. It interprets each of the four robustness values for you,
and flags low robustness values.
interpret_table(df)interpret_table(df)
df |
a datasdrame, as returned by |
A string
create_simulation <- function(n=10^7, rho = .5) { w <- rnorm(n) z <- sqrt(rho)*w + sqrt(1-rho)*rnorm(n) y <- 2*z + rnorm(n) return(list( w = w, z = z, y = y )) } weak_instrument_data <- create_simulation(rho = .01) df <- robustness_values( weak_instrument_data$w, weak_instrument_data$z, weak_instrument_data$y ) cat(interpret_table(df))create_simulation <- function(n=10^7, rho = .5) { w <- rnorm(n) z <- sqrt(rho)*w + sqrt(1-rho)*rnorm(n) y <- 2*z + rnorm(n) return(list( w = w, z = z, y = y )) } weak_instrument_data <- create_simulation(rho = .01) df <- robustness_values( weak_instrument_data$w, weak_instrument_data$z, weak_instrument_data$y ) cat(interpret_table(df))
Calculate Robustness Values
robustness_values(w, z, y, X = NULL)robustness_values(w, z, y, X = NULL)
w |
the instrument vector, a numeric (double) vector with no NA values |
z |
the treatment vector, a numeric (double) vector with no NA values |
y |
the outcome vecctor, a numeric (double) vector with no NA values |
X |
an optional matrix of covariates to residualize on |
a dataframe containing robustness values with the following columns:
Method The method for the associated Robustness Value:
SOO - Selection on observables
IV - Instrumental variables
ExogenousIV - Instrumental variables, where exogeneity is known to be satisfied (as in a randomized experiment)
ExcludableIV - Instrumental variables, where the exclusion restriction is known to be satisfied
RV the robustness value
rho_1, rho_2, rho_3 The parameters used to achieve this robustness value
bias The bias achieved at this combination of parameters
assumption gap the largest gap between partial correlations that are assumed to be zero (only relevant for ExogenousIV and ExcludableIV) and the actual value found by the optimizer. This should be negligible and close to the machine tolerance.
create_simulation <- function(n=10^7, rho = .5) { w <- rnorm(n) z <- sqrt(rho)*w + sqrt(1-rho)*rnorm(n) y <- 2*z + rnorm(n) return(list( w = w, z = z, y = y )) } strong_instrument_data <- create_simulation(rho = .90) weak_instrument_data <- create_simulation(rho = .01) robustness_values( strong_instrument_data$w, strong_instrument_data$z, strong_instrument_data$y ) robustness_values( weak_instrument_data$w, weak_instrument_data$z, weak_instrument_data$y )create_simulation <- function(n=10^7, rho = .5) { w <- rnorm(n) z <- sqrt(rho)*w + sqrt(1-rho)*rnorm(n) y <- 2*z + rnorm(n) return(list( w = w, z = z, y = y )) } strong_instrument_data <- create_simulation(rho = .90) weak_instrument_data <- create_simulation(rho = .01) robustness_values( strong_instrument_data$w, strong_instrument_data$z, strong_instrument_data$y ) robustness_values( weak_instrument_data$w, weak_instrument_data$z, weak_instrument_data$y )