Bayesian model averaging
rbma_g = bma_g(namey,ndraws,arg1,...,argn)
* namey = a time series, a real (nx1) vector or a string equal to the name of a time series or a (nx1) real vector between quotes
* ndraws = # of draws
* argi = arguments which can be:
- a time series
- a real (nx1) vector
- a real (nxk) matrix
- a string equal to the name of a time series or a (nxk) real vector or matrix between quotes
- a list of such elements
- 'nvmax=xx' maximum number of variable allowed in each model
- 'burnin=xx' number of burn-in MCMC simulation
- 'g =XX' value of g-prior (default = 1/max(n,k^2))
- 'mcmc = ''mc3'' or ''jump''' type of MCMC algorithm (MC3 or reversible jump) must be in quote
- 'nvmax=xx' maximum number of variable allowed in each model
- the string 'noprint' if the user doesn't want to print the results of the regression
* 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
-rbma_g('namey') = name of the y variable
-rbma_g('namex') = name of the x variables
-rbma_g('bounds')= if there is a timeseries in the regression, the bounds of the regression
-rbma_g('mcmc') = type of MCMC algorithm
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 // BMA estimation rbma = bma_g('lcrime',30000,'lm','so','led','lpo1','lpo2','llf','lmf','lpop','lnw','lu1','lu2',... 'lgdp','lineq','lprob','ltime','burnin=10000','mcmc=''mc3'''); // Example taken from bma_d() | ![]() | ![]() |