Video tutorial
#install.packages("BMS")
# Activating packages
suppressWarnings(suppressMessages({
library(tidyverse) # Modern data science workflow
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
library(RCurl) # To download files from URLs
}))
# Adjustments
options(warn = -1)
options(scipen = 10000)
options(repr.plot.width = 6, repr.plot.height = 5)
Import data
# Import data of FLS
data(datafls)
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)
coef(mfls)
options(repr.plot.width = 7, repr.plot.height = 4)
plotConv(mfls)
cor(pmp.bma(mfls))
options(repr.plot.width = 7, repr.plot.height = 5)
density(mfls,"GDP60")
density(mfls,"Abslat")
density(mfls,reg="Abslat",addons="",xlim=c(-.0004,.0004))
density(mfls,reg="Catholic",addons="ml")
options(repr.plot.width = 8, repr.plot.height = 12)
image(mfls[1:500])
plotModelsize(mfls)
beta.draws.bma(mfls[1:5])