📄 becmf_gd.m
字号:
% PURPOSE: An example of using becmf_g(), % Gibbs estimates and forecast using% an error correction model % (with Minnesota prior) %---------------------------------------------------% USAGE: becmf_gd%---------------------------------------------------load test.dat; % a test data set containing % monthly mining employment for % il,in,ky,mi,oh,pa,tn,wv% data covers 1982,1 to 1996,5dates = cal(1982,1,12);% vnames = strvcat('il','in','ky','mi','oh','pa','tn','wv');y = test(:,1:2); % use only two variablesvnames = [' il', ' in']; [nobs neqs] = size(y);nlag = 2; % number of lags in var-modeltight = 0.1;decay = 0.1;weight = 0.5; % symmetric weights% this is an example of using 1st-order contiguity% of the states as weights as in LeSage and Pan (1995)% `Using Spatial Contiguity as Bayesian Prior Information % in Regional Forecasting Models'' International Regional % Science Review, Volume 18, no. 1, pp. 33-53, 1995.w = [1.0 1.0 1.0 0.1 0.1 0.1 0.1 0.1 1.0 1.0 1.0 1.0 1.0 0.1 0.1 0.1 1.0 1.0 1.0 0.1 1.0 0.1 1.0 1.0 0.1 1.0 0.1 1.0 1.0 0.1 0.1 0.1 0.1 1.0 1.0 1.0 1.0 1.0 0.1 1.0 0.1 0.1 0.1 0.1 1.0 1.0 0.1 1.0 0.1 0.1 1.0 0.1 0.1 0.1 1.0 0.1 0.1 0.1 1.0 0.1 1.0 1.0 0.1 1.0];% set up prior structureprior.tight = tight;prior.decay = decay;prior.weight = weight;prior.rval = 50; % homoscedastic prior% prior.rval = 4; % heteroscedastic priorndraw = 1100;nomit = 100;begf = ical(1995,1,dates); % beginning forecast datenfor = 12; % # of forecastsendf = ical(1995,12,dates); % end forecast dates% straight becm model with routine determining # cointegrating vectorsyfor1 = becmf(y,nlag,nfor,begf,tight,weight,decay);% estimate the Gibbs modelyfor2 = becmf_g(y,nlag,nfor,begf,prior,ndraw,nomit);rnames = 'Dates';for i=begf:endfrnames = strvcat(rnames,tsdate(dates,i));end;in.rnames = rnames;in.fmt = '%9.3f';in.cnames = vnames;fprintf(1,'BECM forecasts \n');mprint(yfor1,in);fprintf(1,'BECM Gibbs forecasts \n');mprint(yfor2,in);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -