These functions compute bias adjusted estimates (adjusted_estimate), standard-errors (adjusted_se) and t-values (adjusted_t), given a hypothetical strength of the confounder in the partial R2 parameterization.

The functions work either with an lm object, or directly passing in numerical inputs, such as the current coefficient estimate, standard error and degrees of freedom.

adjusted_estimate(model, ...)

# S3 method for lm
adjusted_estimate(model, treatment, r2dz.x, r2yz.dx, reduce = TRUE, ...)

# S3 method for fixest
adjusted_estimate(model, treatment, r2dz.x, r2yz.dx, reduce = TRUE, ...)

# S3 method for numeric
adjusted_estimate(estimate, se, dof, r2dz.x, r2yz.dx, reduce = TRUE, ...)

adjusted_se(model, ...)

# S3 method for numeric
adjusted_se(se, dof, r2dz.x, r2yz.dx, ...)

# S3 method for lm
adjusted_se(model, treatment, r2dz.x, r2yz.dx, ...)

# S3 method for fixest
adjusted_se(model, treatment, r2dz.x, r2yz.dx, message = TRUE, ...)

adjusted_t(model, ...)

# S3 method for lm
adjusted_t(model, treatment, r2dz.x, r2yz.dx, reduce = TRUE, h0 = 0, ...)

# S3 method for fixest
adjusted_t(
  model,
  treatment,
  r2dz.x,
  r2yz.dx,
  reduce = TRUE,
  h0 = 0,
  message = T,
  ...
)

# S3 method for numeric
adjusted_t(estimate, se, dof, r2dz.x, r2yz.dx, reduce = TRUE, h0 = 0, ...)

adjusted_partial_r2(model, ...)

# S3 method for numeric
adjusted_partial_r2(
  estimate,
  se,
  dof,
  r2dz.x,
  r2yz.dx,
  reduce = TRUE,
  h0 = 0,
  ...
)

# S3 method for lm
adjusted_partial_r2(
  model,
  treatment,
  r2dz.x,
  r2yz.dx,
  reduce = TRUE,
  h0 = 0,
  ...
)

# S3 method for fixest
adjusted_partial_r2(
  model,
  treatment,
  r2dz.x,
  r2yz.dx,
  reduce = TRUE,
  h0 = 0,
  ...
)

bias(model, ...)

# S3 method for numeric
bias(se, dof, r2dz.x, r2yz.dx, ...)

# S3 method for lm
bias(model, treatment, r2dz.x, r2yz.dx, ...)

# S3 method for fixest
bias(model, treatment, r2dz.x, r2yz.dx, ...)

relative_bias(...)

# S3 method for lm
relative_bias(model, treatment, r2dz.x, r2yz.dx, ...)

# S3 method for fixest
relative_bias(model, treatment, r2dz.x, r2yz.dx, ...)

# S3 method for numeric
relative_bias(estimate, se, dof, r2dz.x, r2yz.dx, ...)

rel_bias(r.est, est)

Arguments

model

An fixest object with the outcome regression.

...

Arguments passed to other methods. First argument should either be an lm model with the outcome regression or a numeric vector with the coefficient estimate.

treatment

A character vector with the name of the treatment variable of the model.

r2dz.x

Hypothetical partial R2 of unobserved confounder Z with treatment D, given covariates X.

r2yz.dx

Hypothetical partial R2 of unobserved confounder Z with outcome Y, given covariates X and treatment D.

reduce

Should the bias adjustment reduce or increase the absolute value of the estimated coefficient? Default is TRUE.

estimate

Coefficient estimate.

se

Standard error of the coefficient estimate.

dof

Residual degrees of freedom of the regression.

message

should messages be printed? Default = TRUE.

h0

Null hypothesis for computation of the t-value. Default is zero.

r.est

restricted estimate. A numerical vector.

est

unrestricted estimate. A numerical vector.

Value

Numeric vector with bias, adjusted estimate, standard error, or t-value.

References

Cinelli, C. and Hazlett, C. (2020), "Making Sense of Sensitivity: Extending Omitted Variable Bias." Journal of the Royal Statistical Society, Series B (Statistical Methodology).

Examples

# loads data
data("darfur")

# fits model
model <- lm(peacefactor ~ directlyharmed + age +
                          farmer_dar + herder_dar +
                           pastvoted + hhsize_darfur +
                           female + village, data = darfur)

# computes adjusted estimate for confounder with  r2dz.x = 0.05, r2yz.dx = 0.05
adjusted_estimate(model, treatment = "directlyharmed", r2dz.x = 0.05, r2yz.dx = 0.05)
#> directlyharmed 
#>     0.06393214 

# computes adjusted SE for confounder with  r2dz.x = 0.05, r2yz.dx = 0.05
adjusted_se(model, treatment = "directlyharmed", r2dz.x = 0.05, r2yz.dx = 0.05)
#> directlyharmed 
#>      0.0232714 

# computes adjusted t-value for confounder with  r2dz.x = 0.05, r2yz.dx = 0.05
adjusted_t(model, treatment = "directlyharmed", r2dz.x = 0.05, r2yz.dx = 0.05)
#> [1] 2.747241
#> H0:tau = 0

# Alternatively, pass in numerical values directly.
adjusted_estimate(estimate = 0.09731582, se = 0.02325654,
                  dof = 783, r2dz.x = 0.05, r2yz.dx = 0.05)
#> [1] 0.06393214

adjusted_se(estimate = 0.09731582, se = 0.02325654,
            dof = 783, r2dz.x = 0.05, r2yz.dx = 0.05)
#> [1] 0.02327141

adjusted_t(estimate = 0.09731582, se = 0.02325654,
           dof = 783, r2dz.x = 0.05, r2yz.dx = 0.05)
#> [1] 2.74724
#> H0:tau = 0