robustness_value: Computes the (extreme) robustness value

View source: R/sensitivity_stats.R

robustness_valueR Documentation

Computes the (extreme) robustness value

Description

This function computes the (extreme) robustness value of a regression coefficient.

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

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 (2020).

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

rv is a shorthand wrapper for robustness_value.

xrv is a shorthand wrapper for extreme_robustness_value.

Usage

robustness_value(...)

rv(...)

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

## S3 method for class 'fixest'
robustness_value(
  model,
  covariates = NULL,
  q = 1,
  alpha = 0.05,
  message = TRUE,
  ...
)

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

extreme_robustness_value(...)

xrv(...)

## S3 method for class 'lm'
extreme_robustness_value(model, covariates = NULL, q = 1, alpha = 0.05, ...)

## S3 method for class 'fixest'
extreme_robustness_value(
  model,
  covariates = NULL,
  q = 1,
  alpha = 0.05,
  message = TRUE,
  ...
)

## Default S3 method:
extreme_robustness_value(model, ...)

## S3 method for class 'numeric'
extreme_robustness_value(t_statistic, dof, q = 1, alpha = 0.05, ...)

Arguments

...

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

model

an fixest 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.

message

should messages be printed? Default = TRUE.

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. (2020), "Making Sense of Sensitivity: Extending Omitted Variable Bias." Journal of the Royal Statistical Society, Series B (Statistical Methodology).

Examples


# 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", alpha = 1)

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

## note it equals the partial R2 of the treatment with the outcome
partial_r2(model, covariates = "directlyharmed")

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

## 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, alpha = 1)

extreme_robustness_value(t_statistic = 4.18445, dof = 783, alpha = 1)


chadhazlett/sensemakr documentation built on Dec. 12, 2023, 11:20 a.m.