library(foreach)
library(dplyr)
# Draw 100 datasets from UCDP uncertainty model and return as a list
data('ucdpged')
ucdp_sb <- ucdpged %>% filter(type_of_violence == 1)
list_of_models <- foreach(i = 1:100) %do%{
lm(ged_sb_draw ~ year + region, data =
ucdp_sb %>% mutate(ged_sb_draw = runcertainUCDP(n = n(), fatalities = best, tov = 'sb')))
}
#' # Pool model coefficients and standard errors via Rubin's rules
pooled_results <- models_rubin_rules(list_of_models)
Run the code above in your browser using DataLab