View source: R/sensitivity_stats.R
robustness_value | R Documentation |
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
.
robustness_value(...)
rv(...)
## S3 method for class 'lm'
robustness_value(
model,
covariates = NULL,
q = 1,
alpha = 0.05,
invert = FALSE,
...
)
## S3 method for class 'fixest'
robustness_value(
model,
covariates = NULL,
q = 1,
alpha = 0.05,
invert = FALSE,
message = TRUE,
...
)
## Default S3 method:
robustness_value(model, ...)
## S3 method for class 'numeric'
robustness_value(t_statistic, dof, q = 1, alpha = 0.05, invert = FALSE, ...)
extreme_robustness_value(...)
xrv(...)
## S3 method for class 'lm'
extreme_robustness_value(
model,
covariates = NULL,
q = 1,
alpha = 0.05,
invert = FALSE,
...
)
## S3 method for class 'fixest'
extreme_robustness_value(
model,
covariates = NULL,
q = 1,
alpha = 0.05,
invert = FALSE,
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,
invert = FALSE,
...
)
... |
arguments passed to other methods. First argument should either be an |
model |
an |
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 |
alpha |
significance level. |
invert |
should IRV be computed instead of RV? (i.e. is the estimate insignificant?). Default is |
message |
should messages be printed? Default = TRUE. |
t_statistic |
|
dof |
residual degrees of freedom of the regression |
The function returns a numerical vector with the robustness value. The arguments q and alpha are saved as attributes of the vector for reference.
Cinelli, C. and Hazlett, C. (2020), "Making Sense of Sensitivity: Extending Omitted Variable Bias." Journal of the Royal Statistical Society, Series B (Statistical Methodology).
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.