# 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)
Run the code above in your browser using DataLab