Learn R Programming

sensemakr (version 0.1.2)

robustness_value: Computes the robustness value

Description

This function computes the robustness value of a regression coefficient.

The robustness value describes the minimum strength of association (parameterized in terms of partial R2) that omitted variables would need to have both with the treatment and with the outcome to change the estimated coefficient by a certain amount (for instance, to bring it down to zero).

For instance, a robustness value of 1% means that an unobserved confounder that explain 1% of the residual variance of the outcome and 1% of the residual variance of the treatment is strong enough to explain away the estimated effect. Whereas a robustness value of 90% means that any unobserved confounder that explain less than 90% of the residual variance of both the outcome and the treatment assignment cannot fully account for the observed effect. You may also compute robustness value taking into account sampling uncertainty. See details in Cinelli and Hazlett (2018).

The function robustness_value can take as input an lm object or you may directly pass the t-value and degrees of freedom.

Usage

robustness_value(...)

# S3 method for lm robustness_value(model, covariates = NULL, q = 1, alpha = NULL, ...)

# S3 method for numeric robustness_value(t_statistic, dof, q = 1, alpha = NULL, ...)

Arguments

...

arguments passed to other methods. First argument should either be an lm model with the regression model or a numeric vector with the t-value of the coefficient estimate

model

an lm object with the regression model.

covariates

model covariates for which the robustness value will be computed. Default is to compute the robustness value of all covariates.

q

percent change of the effect estimate that would be deemed problematic. Default is 1, which means a reduction of 100% of the current effect estimate (bring estimate to zero). It has to be greater than zero.

alpha

significance level used for computation of the robustness value. If NULL (the default), the robustness value refers only to the point estimate, no sampling uncertainty is taken into account.

t_statistic

numeric vector with the t-value of the coefficient estimates

dof

residual degrees of freedom of the regression

Value

The function returns a numerical vector with the robustness value. The arguments q and alpha are saved as attributes of the vector for reference.

References

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

Examples

Run this code
# NOT RUN {
# using an lm object
## loads data
data("darfur")

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

## robustness value of directly harmed q =1 (reduce estimate to zero)
robustness_value(model, covariates = "directlyharmed")

## robustness value of directly harmed q = 1/2 (reduce estimate in half)
robustness_value(model, covariates = "directlyharmed", q = 1/2)

## robustness value of directly harmed q = 1/2, alpha = 0.05
## (reduce estimate in half, with 95% confidence)
robustness_value(model, covariates = "directlyharmed", q = 1/2, alpha = 0.05)

# you can also provide the statistics directly
robustness_value(t_statistic = 4.18445, dof = 783)
# }

Run the code above in your browser using DataLab