Model uncertainty and robust determinants of economic growth

Video tutorial

Set up

#install.packages("BMS")
library(tidyverse)  # Modern data science workflow
library(DT)  # Interactive tables 
library(BMS) # Bayesian model averaging 
library(patchwork) # make it simple to combine separate ggplots 
library(plotly) # Create interactive web graphics from 'ggplot2'
library(ggrepel) # For displaying labels on ggplot2 object
options(scipen = 10000, digits = 3)

Import data

data(datafls)

Estimation

mfls <- bms(datafls, burn=100000, iter=200000, g="BRIC", mprior="uniform", nmodel=2000, mcmc="bd", user.int=FALSE)

Results

coef(mfls, exact=TRUE)
                PIP      Post Mean      Post SD Cond.Pos.Sign Idx
GDP60       1.00000 -0.01621163822 0.0029397012       0.00000  12
Confucian   0.99968  0.05622942652 0.0125262398       1.00000  19
EquipInv    0.96262  0.16593573538 0.0598095477       1.00000  38
LifeExp     0.95980  0.00083977431 0.0003070705       1.00000  11
SubSahara   0.78624 -0.01203255110 0.0077610845       0.00000   7
Muslim      0.67856  0.00870934249 0.0070744867       1.00000  23
RuleofLaw   0.55657  0.00859034347 0.0085124974       1.00000  26
EcoOrg      0.49963  0.00137104834 0.0015033017       1.00000  14
YrsOpen     0.48178  0.00707019840 0.0080590238       1.00000  15
Protestants 0.47289 -0.00594686796 0.0070677671       0.00000  25
NequipInv   0.44215  0.02583737298 0.0321128974       1.00000  39
Mining      0.40266  0.01619644944 0.0220476260       1.00000  13
PrScEnroll  0.15629  0.00333690532 0.0085756108       0.99898  10
LatAmerica  0.15402 -0.00133330390 0.0034755372       0.01940   6
Buddha      0.12960  0.00163086080 0.0047328824       1.00000  17
BlMktPm     0.12421 -0.00097482234 0.0028791291       0.00000  41
Catholic    0.09296 -0.00042549082 0.0026381771       0.22001  18
Hindu       0.07385 -0.00180634278 0.0074147694       0.02047  21
CivlLib     0.06737 -0.00015869968 0.0006678613       0.00000  34
PrExports   0.04304 -0.00043664144 0.0023622286       0.00000  24
PolRights   0.04127 -0.00006754058 0.0003776697       0.00000  33
RFEXDist    0.03778 -0.00000227261 0.0000130889       0.00964  37
Age         0.02916 -0.00000132404 0.0000090754       0.00000  16
WarDummy    0.02741 -0.00010687737 0.0007581351       0.00000   5
English     0.02604 -0.00016640125 0.0012264899       0.00000  35
Foreign     0.02592  0.00013405946 0.0009718914       0.96321  36
LabForce    0.02176  0.00000000155 0.0000000161       0.81591  29
EthnoL      0.01582  0.00009547467 0.0009776933       0.95818  20
stdBMP      0.01483 -0.00000022696 0.0000023671       0.00000  40
Spanish     0.01424  0.00005750795 0.0007589474       0.87434   2
French      0.01199  0.00005337853 0.0006147571       1.00000   3
Abslat      0.00946  0.00000015753 0.0000146365       0.47515   1
WorkPop     0.00857 -0.00005620829 0.0009348421       0.08300  28
Popg        0.00839  0.00138962603 0.0214997725       0.98383  27
RevnCoup    0.00728  0.00000622887 0.0005204734       0.63504  32
HighEnroll  0.00694 -0.00023058472 0.0041011208       0.00000  30
Brit        0.00671 -0.00001367055 0.0002535045       0.00000   4
OutwarOr    0.00659 -0.00001124738 0.0002352289       0.08085   8
Jewish      0.00637 -0.00005912745 0.0012103137       0.09982  22
PublEdupct  0.00543  0.00019032450 0.0104785963       0.60968  31
Area        0.00481 -0.00000000151 0.0000000393       0.09935   9
plotConv(mfls)

cor(pmp.bma(mfls))
            PMP (Exact) PMP (MCMC)
PMP (Exact)       1.000      0.938
PMP (MCMC)        0.938      1.000
density(mfls,"GDP60")

density(mfls,"Abslat")

density(mfls,reg="Abslat",addons="",xlim=c(-.0004,.0004))

density(mfls,reg="Catholic",addons="ml")

image(mfls[1:500])

plotModelsize(mfls)

beta.draws.bma(mfls[1:5])
            0046845800c 0046844800c 00474440008 00064450008 00464440008
Abslat         0.000000     0.00000     0.00000     0.00000    0.000000
Spanish        0.000000     0.00000     0.00000     0.00000    0.000000
French         0.000000     0.00000     0.00000     0.00000    0.000000
Brit           0.000000     0.00000     0.00000     0.00000    0.000000
WarDummy       0.000000     0.00000     0.00000     0.00000    0.000000
LatAmerica     0.000000     0.00000     0.00000     0.00000    0.000000
SubSahara     -0.013298    -0.01659    -0.01191     0.00000   -0.010451
OutwarOr       0.000000     0.00000     0.00000     0.00000    0.000000
Area           0.000000     0.00000     0.00000     0.00000    0.000000
PrScEnroll     0.000000     0.00000     0.00000     0.00000    0.000000
LifeExp        0.000788     0.00081     0.00114     0.00103    0.000946
GDP60         -0.016532    -0.01842    -0.01669    -0.01300   -0.016124
Mining         0.000000     0.00000     0.04184     0.00000    0.000000
EcoOrg         0.003055     0.00287     0.00000     0.00000    0.000000
YrsOpen        0.000000     0.00000     0.01569     0.01758    0.015318
Age            0.000000     0.00000     0.00000     0.00000    0.000000
Buddha         0.000000     0.00000     0.00000     0.00000    0.000000
Catholic       0.000000     0.00000     0.00000     0.00000    0.000000
Confucian      0.057483     0.05756     0.05891     0.05762    0.054865
EthnoL         0.000000     0.00000     0.00000     0.00000    0.000000
Hindu          0.000000     0.00000     0.00000     0.00000    0.000000
Jewish         0.000000     0.00000     0.00000     0.00000    0.000000
Muslim         0.010014     0.01069     0.01178     0.01174    0.011017
PrExports      0.000000     0.00000     0.00000     0.00000    0.000000
Protestants   -0.011024     0.00000     0.00000    -0.01363    0.000000
RuleofLaw      0.016799     0.01660     0.00000     0.00000    0.000000
Popg           0.000000     0.00000     0.00000     0.00000    0.000000
WorkPop        0.000000     0.00000     0.00000     0.00000    0.000000
LabForce       0.000000     0.00000     0.00000     0.00000    0.000000
HighEnroll     0.000000     0.00000     0.00000     0.00000    0.000000
PublEdupct     0.000000     0.00000     0.00000     0.00000    0.000000
RevnCoup       0.000000     0.00000     0.00000     0.00000    0.000000
PolRights      0.000000     0.00000     0.00000     0.00000    0.000000
CivlLib        0.000000     0.00000     0.00000     0.00000    0.000000
English        0.000000     0.00000     0.00000     0.00000    0.000000
Foreign        0.000000     0.00000     0.00000     0.00000    0.000000
RFEXDist       0.000000     0.00000     0.00000     0.00000    0.000000
EquipInv       0.158737     0.15386     0.17598     0.21801    0.227428
NequipInv      0.063549     0.06029     0.00000     0.00000    0.000000
stdBMP         0.000000     0.00000     0.00000     0.00000    0.000000
BlMktPm        0.000000     0.00000     0.00000     0.00000    0.000000

References

  • R-Package BMS: Bayesian Model Averaging in R: http://bms.zeugner.eu/
  • Zeugner, S., & Feldkircher, M. (2015). Bayesian model averaging employing fixed and flexible priors: The BMS package for R. Journal of Statistical Software, 68(4), 1-37.
  • Amini, S., & Parmeter, C. F. (2020). A review of the ‘BMS’ package for R with focus on jointness. Econometrics, 8(1), 1–21. https://doi.org/10.3390/econometrics8010006
  • Run the code in colab: https://colab.research.google.com/gist/cmg777/d9d4e233d29e50ee71095a1c3f8e6733/r-model-uncertainty-and-bma.ipynb