Learn R Programming

sensemakr (version 0.1.2)

adjusted_estimate: Bias-adjusted estimates, standard-errors and t-values

Description

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.

Usage

adjusted_estimate(...)

# S3 method for lm 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(...)

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

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

adjusted_t(...)

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

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

bias(...)

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

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

Arguments

...

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.

model

An lm object with the outcome regression.

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.

h0

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

Value

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

References

Cinelli, C. and Hazlett, C. "Making Sense of Sensitivity: Extending Omitted Variable Bias." (2018).

Examples

Run this code
# NOT RUN {
# 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)

# 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)

# 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)

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

adjusted_se(estimate = 0.09731582, se = 0.02325654,
            dof = 783, r2dz.x = 0.05, r2yz.dx = 0.05)

adjusted_t(estimate = 0.09731582, se = 0.02325654,
           dof = 783, r2dz.x = 0.05, r2yz.dx = 0.05)

# }

Run the code above in your browser using DataLab