Home > matlab > ms-sbvar > msstart_setup.m

msstart_setup

PURPOSE ^

function []= msstart_setup(options_)

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

function []= msstart_setup(options_)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %function []= msstart_setup(options_)
0002 
0003 % Copyright (C) 2011 Dynare Team
0004 %
0005 % This file is part of Dynare.
0006 %
0007 % Dynare is free software: you can redistribute it and/or modify
0008 % it under the terms of the GNU General Public License as published by
0009 % the Free Software Foundation, either version 3 of the License, or
0010 % (at your option) any later version.
0011 %
0012 % Dynare is distributed in the hope that it will be useful,
0013 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015 % GNU General Public License for more details.
0016 %
0017 % You should have received a copy of the GNU General Public License
0018 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0019 
0020 % ** ONLY UNDER UNIX SYSTEM
0021 %path(path,'/usr2/f1taz14/mymatlab')
0022 
0023 
0024 
0025 %===========================================
0026 % Exordium I
0027 %===========================================
0028 format short g     % format
0029 %
0030 %options_.ms.freq = 4;   % quarters or months
0031 %options_.ms.initial_year=1959;   % beginning of the year
0032 %options_.ms.initial_subperiod=1;    % begining of the quarter or month
0033 %options_.ms.final_year=2005;   % final year
0034 %options_.ms.final_subperiod=4;    % final month or quarter
0035 nData=(options_.ms.final_year-options_.ms.initial_year)*options_.ms.freq + (options_.ms.final_subperiod-options_.ms.initial_subperiod+1);
0036        % total number of the available data -- this is all you have
0037 
0038 %*** Load data and series
0039 %load datainf_argen.prn      % the default name for the variable is "options_.ms.data".
0040 %load datacbogdpffr.prn
0041 %options_.ms.data = datacbogdpffr;
0042 %clear datacbogdpffr;
0043 [nt,ndv]=size(options_.data);
0044 if nt~=nData
0045    disp(' ')
0046    warning(sprintf('nt=%d, Caution: not equal to the length in the data',nt));
0047    %disp(sprintf('nt=%d, Caution: not equal to the length in the data',nt));
0048    disp('Press ctrl-c to abort')
0049    return
0050 end
0051 %--------
0052 %1    CBO output gap --  log(x_t)-log(x_t potential)
0053 %2    GDP deflator -- (P_t/P_{t-1})^4-1.0
0054 %2    FFR/100.
0055 options_.ms.vlist = [1:size(options_.varobs,1)];    % 1: U; 4: PCE inflation.
0056 options_.ms.varlist=cellstr(options_.varobs);
0057 options_.ms.log_var = sort(varlist_indices(options_.ms.vlistlog,options_.varobs));   % subset of "options_.ms.vlist.  Variables in log level so that differences are in **monthly** growth, unlike R and U which are in annual percent (divided by 100 already).
0058 options_.ms.percent_var =setdiff(options_.ms.vlist,options_.ms.log_var);
0059 %options_.ms.restriction_fname='ftd_upperchol3v';   %Only used by msstart2.m.
0060 ylab = options_.ms.varlist;
0061 xlab = options_.ms.varlist;
0062 
0063 %----------------
0064 nvar = size(options_.varobs,1);   % number of endogenous variables
0065 nlogeno = length(options_.ms.log_var);  % number of endogenous variables in options_.ms.log_var
0066 npereno = length(options_.ms.percent_var);  % number of endogenous variables in options_.ms.percent_var
0067 if (nvar~=(nlogeno+npereno))
0068    disp(' ')
0069    warning('Check xlab, nlogeno or npereno to make sure of endogenous variables in options_.ms.vlist')
0070    disp('Press ctrl-c to abort')
0071    return
0072 elseif (nvar==length(options_.ms.vlist))
0073    nexo=1;    % only constants as an exogenous variable.  The default setting.
0074 elseif (nvar<length(options_.ms.vlist))
0075    nexo=length(options_.ms.vlist)-nvar+1;
0076 else
0077    disp(' ')
0078    warning('Make sure there are only nvar endogenous variables in options_.ms.vlist')
0079    disp('Press ctrl-c to abort')
0080    return
0081 end
0082 
0083 
0084 %------- A specific sample is considered for estimation -------
0085 yrStart=options_.ms.initial_year;
0086 qmStart=options_.ms.initial_subperiod;
0087 yrEnd=options_.ms.final_year;
0088 qmEnd=options_.ms.final_subperiod;
0089 %options_.forecast = 4;   % number of years for forecasting
0090 if options_.forecast<1
0091    error('To be safe, the number of forecast years should be at least 1')
0092 end
0093 forelabel = [num2str(yrEnd) ':' num2str(qmEnd) ' Forecast'];
0094 
0095 nSample=(yrEnd-yrStart)*options_.ms.freq + (qmEnd-qmStart+1);
0096 if qmEnd==options_.ms.freq
0097    E1yrqm = [yrEnd+1 1];  % first year and quarter (month) after the sample
0098 else
0099    E1yrqm = [yrEnd qmEnd+1];  % first year and quarter (month) after the sample
0100 end
0101 E2yrqm = [yrEnd+options_.forecast qmEnd];   % end at the last month (quarter) of a calendar year after the sample
0102 [fdates,nfqm]=fn_calyrqm(options_.ms.freq,E1yrqm,E2yrqm);   % forecast dates and number of forecast dates
0103 [sdates,nsqm] = fn_calyrqm(options_.ms.freq,[yrStart qmStart],[yrEnd qmEnd]);
0104    % sdates: dates for the whole sample (including options_.ms.nlags)
0105 if nSample~=nsqm
0106    warning('Make sure that nSample is consistent with the size of sdates')
0107    disp('Hit any key to continue, or ctrl-c to abort')
0108    pause
0109 end
0110 imstp = 4*options_.ms.freq;    % <<>>  impulse responses (4 years)
0111 nayr = 4; %options_.forecast;  % number of years before forecasting for plotting.
0112 
0113 
0114 %------- Prior, etc. -------
0115 %options_.ms.nlags = 4;        % number of options_.ms.nlags
0116 %options_.ms.cross_restrictions = 0;   % 1: cross-A0-and-A+ restrictions; 0: options_.ms.restriction_fname is all we have
0117             % Example for indxOres==1: restrictions of the form P(t) = P(t-1).
0118 %options_.ms.contemp_reduced_form = 0;  % 1: contemporaneous recursive reduced form; 0: restricted (non-recursive) form
0119 %options_.ms.real_pseudo_forecast = 0;  % 1: options_.ms.real_pseudo_forecast forecasts; 0: real time forecasts
0120 %options_.ms.bayesian_prior = 1;  % 1: Bayesian prior; 0: no prior
0121 indxDummy = options_.ms.bayesian_prior;  % 1: add dummy observations to the data; 0: no dummy added.
0122 %options_.ms.dummy_obs = 0;  % No dummy observations for xtx, phi, fss, xdatae, etc.  Dummy observations are used as an explicit prior in fn_rnrprior_covres_dobs.m.
0123 %if indxDummy
0124 %   options_.ms.dummy_obs=nvar+1;         % number of dummy observations
0125 %else
0126 %   options_.ms.dummy_obs=0;    % no dummy observations
0127 %end
0128 %=== The following mu is effective only if options_.ms.bayesian_prior==1.
0129 
0130 mu = options_.ms.coefficients_prior_hyperparameters;
0131 
0132 %   mu(1): overall tightness and also for A0;
0133 %   mu(2): relative tightness for A+;
0134 %   mu(3): relative tightness for the constant term;
0135 %   mu(4): tightness on lag decay;  (1)
0136 %   mu(5): weight on nvar sums of coeffs dummy observations (unit roots);
0137 %   mu(6): weight on single dummy initial observation including constant
0138 %           (cointegration, unit roots, and stationarity);
0139 %
0140 %
0141 hpmsmd = [0.0; 0.0];
0142 indxmsmdeqn = [0; 0; 0; 0];  %This option disenable using this in fn_rnrprior_covres_dobs.m
0143 
0144 
0145 tdf = 3;          % degrees of freedom for t-dist for initial draw of the MC loop
0146 nbuffer = 1000;        % a block or buffer of draws (buffer) that is saved to the disk (not memory)
0147 ndraws1=1*nbuffer;         % 1st part of Monte Carlo draws
0148 ndraws2=10*ndraws1;        % 2nd part of Monte Carlo draws
0149 % seednumber = options_.DynareRandomStreams.seed; %7910;    %472534;   % if 0, random state at each clock time
0150 %            % good one 420 for [29 45], [29 54]
0151 % if seednumber
0152 %    randn('state',seednumber);
0153 %    rand('state',seednumber);
0154 % else
0155 %    randn('state',fix(100*sum(clock)));
0156 %    rand('state',fix(100*sum(clock)));
0157 % end
0158 %  nstarts=1         % number of starting points
0159 %  imndraws = nstarts*ndraws2;   % total draws for impulse responses or forecasts
0160 %<<<<<<<<<<<<<<<<<<<
0161 
0162 
0163 
0164 
0165

Generated on Tue 22-May-2012 02:40:23 by m2html © 2005