library(foreign)
library(regsim)
world_data <- read.dta("http://uclspp.github.io/PUBLG100/data/QoG2012.dta")
model <- lm(undp_hdi ~ wbgi_cce + former_col + wbgi_cce:former_col, data = world_data)
summary(model)
##
## Call:
## lm(formula = undp_hdi ~ wbgi_cce + former_col + wbgi_cce:former_col,
## data = world_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.38655 -0.04182 0.01290 0.06983 0.27860
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.78524 0.01685 46.602 < 2e-16 ***
## wbgi_cce 0.07872 0.01328 5.926 1.67e-08 ***
## former_col -0.11530 0.02078 -5.549 1.08e-07 ***
## wbgi_cce:former_col 0.05279 0.01992 2.650 0.00881 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1207 on 171 degrees of freedom
## (19 observations deleted due to missingness)
## Multiple R-squared: 0.5589, Adjusted R-squared: 0.5512
## F-statistic: 72.23 on 3 and 171 DF, p-value: < 2.2e-16
x <- list(former_col = 0:1, wbgi_cce = -2:3)
sim <- regsim(model, x)
summary(sim)
## Profile 1
## former_col 0
## wbgi_cce -2
##
## 2.5% 50% 97.5%
## p1 0.5517317 0.6276641 0.6947622
## --------------------------------
##
## Profile 2
## former_col 1
## wbgi_cce -2
##
## 2.5% 50% 97.5%
## p2 0.3472378 0.4059664 0.4589139
## --------------------------------
##
## Profile 3
## former_col 0
## wbgi_cce -1
##
## 2.5% 50% 97.5%
## p3 0.6571104 0.7061871 0.753638
## -------------------------------
##
## Profile 4
## former_col 1
## wbgi_cce -1
##
## 2.5% 50% 97.5%
## p4 0.5067297 0.5379558 0.568405
## -------------------------------
##
## Profile 5
## former_col 0
## wbgi_cce 0
##
## 2.5% 50% 97.5%
## p5 0.7535239 0.785475 0.8176957
## -------------------------------
##
## Profile 6
## former_col 1
## wbgi_cce 0
##
## 2.5% 50% 97.5%
## p6 0.6461712 0.6702621 0.6934673
## --------------------------------
##
## Profile 7
## former_col 0
## wbgi_cce 1
##
## 2.5% 50% 97.5%
## p7 0.8334638 0.8640469 0.896834
## -------------------------------
##
## Profile 8
## former_col 1
## wbgi_cce 1
##
## 2.5% 50% 97.5%
## p8 0.7581209 0.8012332 0.8440396
## --------------------------------
##
## Profile 9
## former_col 0
## wbgi_cce 2
##
## 2.5% 50% 97.5%
## p9 0.8956883 0.9440054 0.9910328
## --------------------------------
##
## Profile 10
## former_col 1
## wbgi_cce 2
##
## 2.5% 50% 97.5%
## p10 0.8657216 0.9336028 1.006246
## --------------------------------
##
## Profile 11
## former_col 0
## wbgi_cce 3
##
## 2.5% 50% 97.5%
## p11 0.9546154 1.022979 1.092339
## -------------------------------
##
## Profile 12
## former_col 1
## wbgi_cce 3
##
## 2.5% 50% 97.5%
## p12 0.9717654 1.064757 1.169262
## -------------------------------
plot(sim, ~wbgi_cce + former_col, xlab = "Corruption Control")