Bayesian model averaging
rbma_g = bma_g1(y,x,ndraw,burnin,mcmc,g,nvmax)
* y = dependent variable vector
* x = explanatory variables
* ndraw = # of draws to carry out
* burnin = # of burn-in MCMC simulation
* mcmc = name of the MCMC algorithm (jump_g or mc3_g)
* g = value of g-prior (default = 1/max(nobs,k^2))
* nvmax = max number of variable allowed in each model
* rbma_g = a results tlist with
-rbma_g('meth') = 'bma g-prior'
-rbma_g('nmod') = # of models visited during sampling
-rbma_g('beta') = bhat averaged over all models
-rbma_g('mprob') = posterior prob of each model
-rbma_g('vprob') = posterior prob of each variable
-rbma_g('model') = indicator variables for each model (nmod x k)
-rbma_g('yhat') = yhat averaged over all models
-rbma_g('resid') = residuals based on yhat averaged over models
-rbma_g('sige') = averaged over all models
-rbma_g('nobs') = nobs
-rbma_g('nvar') = # of exogenous
-rbma_g('y') = y data vector
-rbma_g('x') = y data vector
-rbma_g('visit') = visits to each model during sampling (nmod x 1)
-rbma_g('time') = time taken for MCMC sampling
-rbma_g('ndraw') = # of MCMC sampling draws
-rbma_g('burnin')= # of burn-in MCMC simulation
-rbma_g('gprior')= value of g-prior
load(GROCERDIR+'/data/crime.dat') // take log of data listn = ['crime';'m';'ed';'po1';'po2';'lf';'mf';'pop';'nw';'u1';'u2';'gdp';'ineq';'prob';'time'] ; for i =1:size(listn,1) execstr('l'+listn(i)+' = log('+listn(i)+')') end [y,namey,x]=explouniv('lcrime',['lm','so','led','lpo1','lpo2','llf','lmf','lpop','lnw','lu1','lu2',... 'lgdp','lineq','lprob','ltime']) rbma_g = bma_g1(y,x,30000,10000,mc3_g) // bma_g1 on y (log of crime) and x (explanatory variables), with 30000 draws, 10000 draws discarded, // mc3 algorithm, default g-prior and maximum # of variables authorized in the models rbma_g = bma_g1(y,x,30000,10000,mc3_g,0.1,10) // the same but with a greater g_priori (0.1 instead of 1/15) and a maximum # of variables limited to 10 | ![]() | ![]() |