The function eba(), however, also offers a great deal of flexibility for researchers who might be interested in conducting a different kind of extreme bounds analysis.
Every aspect of EBA is fully customizable: eba() can estimate any type of regression model (argument reg.fun), not just Ordinary Least Squares (OLS). Researchers can thus easily perform EBA using, for instance, logistic or probit regressions.
Attention can, furthermore, be restricted to regressions in which the variance inflation factor on the examined coefficient does not exceed a set maximum (argument vif). Alternatively, users can request that eba() only use results from regression models that meet some other, user-specified condition (argument include.fun)
naive.eba <- eba(formula = mpg ~ cyl + carb + disp + hp + vs + drat +
wt + qsec + gear + am, data = mtcars, k = 0:9)
## ExtremeBounds: eba() performing analysis. Please wait.
##
## Preparing variables (1/4): Done.
##
## Generating combinations (2/4): Estimate all 1023 combinations.
##
## Estimating regressions (3/4):
## 1 / 1023 (0.1%)
## 103 / 1023 (10.07%)
## 205 / 1023 (20.04%)
## 307 / 1023 (30.01%)
## 410 / 1023 (40.08%)
## 512 / 1023 (50.05%)
## 614 / 1023 (60.02%)
## 717 / 1023 (70.09%)
## 819 / 1023 (80.06%)
## 921 / 1023 (90.03%)
## 1023 / 1023 (100%)
##
## Calculating bounds (4/4): Done.
#naive.eba <- eba(data = mtcars, y = "mpg", doubtful = c("cyl", "carb",
# "disp", "hp", "vs", "drat", "wt", "qsec", "gear", "am"), k = 0:9)
se.robust <- function(model.object) {
model.fit <- vcovHC(model.object, type = "HC")
out <- sqrt(diag(model.fit))
return(out)
}
sophisticated.eba <- eba(formula = mpg ~ wt | cyl + carb + disp + hp |
vs + drat + wt + qsec + gear + am, data = mtcars, exclusive = ~ cyl
+ carb + disp + hp | am + gear, vif = 7, se.fun = se.robust,
weights = "lri")
## ExtremeBounds: eba() performing analysis. Please wait.
##
## Preparing variables (1/4): Done.
##
## Generating combinations (2/4): Estimate all 148 combinations.
##
## Estimating regressions (3/4):
## 1 / 148 (0.68%)
## 15 / 148 (10.14%)
## 30 / 148 (20.27%)
## 45 / 148 (30.41%)
## 60 / 148 (40.54%)
## 74 / 148 (50%)
## 89 / 148 (60.14%)
## 104 / 148 (70.27%)
## 119 / 148 (80.41%)
## 134 / 148 (90.54%)
## 148 / 148 (100%)
##
## Calculating bounds (4/4): Done.
doubtful.variables <- c("cyl", "carb", "disp", "hp", "vs", "drat", "wt",
"qsec", "gear", "am")
engine.variables <- c("cyl", "carb", "disp", "hp")
transmission.variables <- c("am", "gear")
sophisticated.eba <- eba(data = mtcars, y = "mpg", free = "wt",
doubtful = doubtful.variables, focus = engine.variables,
exclusive = list(engine.variables, transmission.variables),
vif = 7, se.fun = se.robust, weights = "lri")
## ExtremeBounds: eba() performing analysis. Please wait.
##
## Preparing variables (1/4): Done.
##
## Generating combinations (2/4): Estimate all 148 combinations.
##
## Estimating regressions (3/4):
## 1 / 148 (0.68%)
## 15 / 148 (10.14%)
## 30 / 148 (20.27%)
## 45 / 148 (30.41%)
## 60 / 148 (40.54%)
## 74 / 148 (50%)
## 89 / 148 (60.14%)
## 104 / 148 (70.27%)
## 119 / 148 (80.41%)
## 134 / 148 (90.54%)
## 148 / 148 (100%)
##
## Calculating bounds (4/4): Done.
hist(sophisticated.eba, variables = c("cyl", "carb", "disp", "hp"),
main = c(cyl = "number of cylinders", carb = "number of carburetors",
disp = "engine displacement", hp = "gross horsepower"),
normal.show = TRUE) #ok
#EBA analysis
print(sophisticated.eba) #ok
##
## Call:
## eba(data = mtcars, y = "mpg", free = "wt", doubtful = doubtful.variables,
## focus = engine.variables, vif = 7, exclusive = list(engine.variables,
## transmission.variables), se.fun = se.robust, weights = "lri")
##
## Confidence level: 0.95
## Number of combinations: 148
## Regressions estimated: 148 (100% of combinations)
##
## Number of regressions by variable:
##
## (Intercept) wt cyl carb disp hp
## 148 148 37 37 37 37
##
## Number of coefficients used by variable:
##
## (Intercept) wt cyl carb disp hp
## 148 148 26 37 14 37
##
## Beta coefficients:
##
## Type Coef (Wgt Mean) SE (Wgt Mean) Min Coef SE (Min Coef)
## (Intercept) free 26.199 6.286 3.001 9.058
## wt free -3.623 0.902 -5.216 1.163
## cyl focus -1.370 0.403 -1.528 0.346
## carb focus -0.822 0.327 -1.481 0.365
## disp focus -0.016 0.008 -0.018 0.008
## hp focus -0.027 0.008 -0.037 0.007
## Max Coef SE (Max Coef)
## (Intercept) 42.386 4.505
## wt -2.521 0.869
## cyl -0.928 0.525
## carb -0.157 0.263
## disp -0.007 0.008
## hp -0.018 0.008
##
## Distribution of beta coefficients:
##
## Type Pct(beta < 0) Pct(beta > 0) Pct(significant != 0)
## (Intercept) free 0 100 79.730
## wt free 100 0 100.000
## cyl focus 100 0 92.308
## carb focus 100 0 59.459
## disp focus 100 0 57.143
## hp focus 100 0 81.081
## Pct(signif & beta < 0) Pct(signif & beta > 0)
## (Intercept) 0.000 79.73
## wt 100.000 0.00
## cyl 92.308 0.00
## carb 59.459 0.00
## disp 57.143 0.00
## hp 81.081 0.00
##
## Leamer's Extreme Bounds Analysis (EBA):
##
## Type Lower Extreme Bound Upper Extreme Bound
## (Intercept) free -19.521 55.021
## wt free -7.495 -0.659
## cyl focus -2.295 0.101
## carb focus -2.197 0.358
## disp focus -0.034 0.009
## hp focus -0.052 0.002
## Robust/Fragile? (mu = 0)
## (Intercept) fragile
## wt robust
## cyl fragile
## carb fragile
## disp fragile
## hp fragile
##
## Sala-i-Martin's Extreme Bounds Analysis (EBA):
## - Normal model (N): beta coefficients assumed to be distributed normally across models
## - Generic model (G): no assumption about the distribution of beta coefficients across models
##
## Type N: CDF(beta <= 0) N: CDF(beta > 0) G: CDF(beta <= 0)
## (Intercept) free 0.009 99.991 2.756
## wt free 99.996 0.004 99.957
## cyl focus 99.962 0.038 99.521
## carb focus 99.307 0.693 95.315
## disp focus 96.997 3.003 95.200
## hp focus 99.964 0.036 99.047
## G: CDF(beta > 0)
## (Intercept) 97.244
## wt 0.043
## cyl 0.479
## carb 4.685
## disp 4.800
## hp 0.953