Reputation: 31
In a class, we have been utilizing PSACALC in Stata for Oster's bounding for understanding the degree of omitted variable bias in regression. I'm wondering if there is an alternative anyone is aware of in R.
Upvotes: 3
Views: 609
Reputation: 230
I adapted the code from PSACALC and made an R package about two years ago. I've never gotten around to putting it on CRAN (don't know how), but you can install it from my GitHub. Here's a short example reproducing Table 5 from Oster (2019)
#install.packages("devtools")
library(devtools)
#devtools::install_github("siverskog/oster")
library(oster)
data(nunn)
# FORMULA FOR INTERMEDIATE (TILDE) REGRESSION
f01c <- trust_relatives ~ ln_export_area + age + age2 + male + urban_dum +
as.factor(education) + as.factor(occupation) + as.factor(religion) +
as.factor(living_conditions) + district_ethnic_frac +
frac_ethnicity_in_district + as.factor(isocode) + malaria_ecology +
total_missions_area + explorer_contact + railway_contact + cities_1400_dum +
as.factor(v30) + v33_alt + ln_init_pop_density
# FORMULA FOR SHORT (O) REGRESSION
f01u <- trust_relatives ~ ln_export_area + as.factor(isocode)
# FITS
fit01c <- lm(f01c, data = nunn)
nunn$infit01c <- is.element(rownames(nunn), names(fit01c$residuals))
fit01u <- lm(f01u, data = nunn, subset = infit01c) # USE ONLY OBS. IN TILDE FIT
# CALCULATE BETA/DELTA/RMAX WITH oster() TO
# REPRODUCE ROW 1 OF TABLE 5 IN OSTER (2019)
z <- oster(fit01u, fit01c, "ln_export_area")
b13 <- oster(fit01u, fit01c, "ln_export_area", rm = 1.3)$beta
round(c(z$input$beta_o, z$input$beta_tilde, z$beta, b13, z$rmax), 3)
Upvotes: 2