R/sensitivity_stats.R
sensitivity_stats.Rd
Convenience function that computes the robustness_value
,
partial_r2
and partial_f2
of the coefficient of interest.
sensitivity_stats(model, ...)
# S3 method for lm
sensitivity_stats(model, treatment, q = 1, alpha = 0.05, reduce = TRUE, ...)
# S3 method for fixest
sensitivity_stats(
model,
treatment,
q = 1,
alpha = 0.05,
reduce = TRUE,
message = T,
...
)
# S3 method for numeric
sensitivity_stats(
estimate,
se,
dof,
treatment = "treatment",
q = 1,
alpha = 0.05,
reduce = TRUE,
...
)
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.
A character vector with the name of the treatment variable of the model.
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.
significance level.
Should the bias adjustment reduce or increase the
absolute value of the estimated coefficient? Default is TRUE
.
should messages be printed? Default = TRUE.
Coefficient estimate.
Standard error of the coefficient estimate.
Residual degrees of freedom of the regression.
A data.frame
containing the following quantities:
a character with the name of the treatment variable
a numeric vector with the estimated effect of the treatment
a numeric vector with the estimated standard error of the treatment effect
a numeric vector with the t-value of the treatment
a numeric vector with the partial R2 of the treatment and the outcome, see details in partial_r2
a numeric vector with the robustness value of the treatment, see details in robustness_value
a numeric vector with the robustness value of the treatment considering statistical significance, see details in robustness_value
a numeric vector with the partial (Cohen's) f2 of the treatment with the outcome, see details in partial_f2
a numeric vector with the degrees of freedom of the model
Cinelli, C. and Hazlett, C. (2020), "Making Sense of Sensitivity: Extending Omitted Variable Bias." Journal of the Royal Statistical Society, Series B (Statistical Methodology).
## loads data
data("darfur")
## fits model
model <- lm(peacefactor ~ directlyharmed + age + farmer_dar + herder_dar +
pastvoted + hhsize_darfur + female + village, data = darfur)
## sensitivity stats for directly harmed
sensitivity_stats(model, treatment = "directlyharmed")
#> treatment estimate se t_statistic r2yd.x rv_q
#> 1 directlyharmed 0.09731582 0.02325654 4.18445 0.02187309 0.1387764
#> rv_qa f2yd.x dof
#> 1 0.07625797 0.02236222 783
## you can also pass the numeric values directly
sensitivity_stats(estimate = 0.09731582, se = 0.02325654, dof = 783)
#> treatment estimate se t_statistic r2yd.x rv_q rv_qa
#> 1 treatment 0.09731582 0.02325654 4.18445 0.02187309 0.1387763 0.07625795
#> f2yd.x dof
#> 1 0.02236222 783