Consider options_.varobs as a cell of strings.
parent
cb54eb9a33
commit
985e00b739
|
@ -59,7 +59,7 @@ R = [];
|
|||
P = [];
|
||||
PK = [];
|
||||
decomp = [];
|
||||
nobs = size(options_.varobs,1);
|
||||
nobs = length(options_.varobs);
|
||||
smpl = size(Y,2);
|
||||
|
||||
M_ = set_all_parameters(xparam1,estim_params_,M_);
|
||||
|
|
|
@ -174,17 +174,17 @@ if nvn
|
|||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = ...
|
||||
posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
name = deblank(options_.varobs(estim_params_.nvn_observable_correspondence(i,1),:));
|
||||
name = options_.varobs{estim_params_.nvn_observable_correspondence(i,1)};
|
||||
oo_ = Filloo(oo_,name,type,post_mean,hpd_interval,post_median,post_var,post_deciles,density);
|
||||
else
|
||||
try
|
||||
name = deblank(options_.varobs(estim_params_.nvn_observable_correspondence(i,1),:));
|
||||
name = options_.varobs{estim_params_.nvn_observable_correspondence(i,1)};
|
||||
[post_mean,hpd_interval,post_var] = Extractoo(oo_,name,type);
|
||||
catch
|
||||
Draws = GetAllPosteriorDraws(ip,FirstMhFile,FirstLine,TotalNumberOfMhFiles,NumberOfDraws);
|
||||
[post_mean, post_median, post_var, hpd_interval, post_deciles, density] = ...
|
||||
posterior_moments(Draws,1,options_.mh_conf_sig);
|
||||
name = deblank(options_.varobs(estim_params_.nvn_observable_correspondence(i,1),:));
|
||||
name = options_.varobs{estim_params_.nvn_observable_correspondence(i,1)};
|
||||
oo_ = Filloo(oo_,name,type,post_mean,hpd_interval,post_median,post_var,post_deciles,density);
|
||||
end
|
||||
end
|
||||
|
|
|
@ -89,7 +89,7 @@ for i=1:npar
|
|||
eval(['pmod = oo_.posterior_mode.shocks_std.' name ';'])
|
||||
end
|
||||
elseif i <= nvx+nvn
|
||||
name = deblank(options_.varobs(estim_params_.nvn_observable_correspondence(i-nvx,1),:));
|
||||
name = options_.varobs{estim_params_.nvn_observable_correspondence(i-nvx,1)};
|
||||
eval(['x1 = oo_.posterior_density.measurement_errors_std.' name '(:,1);'])
|
||||
eval(['f1 = oo_.posterior_density.measurement_errors_std.' name '(:,2);'])
|
||||
eval(['oo_.prior_density.mearsurement_errors_std.' name '(:,1) = x2;'])
|
||||
|
|
|
@ -48,7 +48,7 @@ MaxNumberOfPlotPerFigure = 4;% The square root must be an integer!
|
|||
MaxNumberOfBytes=options_.MaxNumberOfBytes;
|
||||
endo_nbr=M_.endo_nbr;
|
||||
exo_nbr=M_.exo_nbr;
|
||||
nvobs = size(options_.varobs,1);
|
||||
nvobs = length(options_.varobs);
|
||||
nn = sqrt(MaxNumberOfPlotPerFigure);
|
||||
iendo = 1:endo_nbr;
|
||||
i_last_obs = gend+(1-M_.maximum_endo_lag:0);
|
||||
|
@ -70,9 +70,9 @@ B = 200;
|
|||
MAX_nruns = min(B,ceil(options_.MaxNumberOfBytes/(npar+2)/8));
|
||||
MAX_nsmoo = min(B,ceil(MaxNumberOfBytes/((endo_nbr)*gend)/8));
|
||||
MAX_ninno = min(B,ceil(MaxNumberOfBytes/(exo_nbr*gend)/8));
|
||||
MAX_nerro = min(B,ceil(MaxNumberOfBytes/(size(options_.varobs,1)*gend)/8));
|
||||
MAX_nerro = min(B,ceil(MaxNumberOfBytes/(length(options_.varobs)*gend)/8));
|
||||
if naK
|
||||
MAX_naK = min(B,ceil(MaxNumberOfBytes/(size(options_.varobs,1)* ...
|
||||
MAX_naK = min(B,ceil(MaxNumberOfBytes/(length(options_.varobs)* ...
|
||||
length(options_.filter_step_ahead)*gend)/8));
|
||||
end
|
||||
if horizon
|
||||
|
|
|
@ -42,7 +42,7 @@ end
|
|||
% Set varlist if necessary
|
||||
varlist = options_.varlist;
|
||||
if isempty(varlist)
|
||||
varlist = options_.varobs;
|
||||
varlist = char(options_.varobs);
|
||||
end
|
||||
options_.varlist = varlist;
|
||||
nvar = size(varlist,1);
|
||||
|
|
|
@ -70,7 +70,7 @@ switch type
|
|||
TYPEarray = 4;
|
||||
case 'irf_bvardsge'
|
||||
CAPtype = 'IRF_BVARDSGE';
|
||||
TYPEsize = [ options_.irf , size(options_.varobs,1) , M_.exo_nbr ];
|
||||
TYPEsize = [ options_.irf , length(options_.varobs) , M_.exo_nbr ];
|
||||
TYPEarray = 4;
|
||||
case 'smooth'
|
||||
CAPtype = 'SMOOTH';
|
||||
|
@ -82,7 +82,7 @@ switch type
|
|||
TYPEarray = 3;
|
||||
case 'error'
|
||||
CAPtype = 'ERROR';
|
||||
TYPEsize = [ size(options_.varobs,1) , options_.nobs ];
|
||||
TYPEsize = [ length(options_.varobs) , options_.nobs ];
|
||||
TYPEarray = 3;
|
||||
case 'innov'
|
||||
CAPtype = 'INNOV';
|
||||
|
|
|
@ -120,7 +120,7 @@ for i = 1:ny
|
|||
dynare_graph([ sims_no_shock_median(:, i) ...
|
||||
sims_no_shock_up_conf(:, i) sims_no_shock_down_conf(:, i) ...
|
||||
sims_with_shocks_up_conf(:, i) sims_with_shocks_down_conf(:, i) ], ...
|
||||
options_.varobs(i, :));
|
||||
options_.varobs{i});
|
||||
end
|
||||
|
||||
dynare_graph_close;
|
||||
|
@ -145,8 +145,8 @@ if ~isempty(forecast_data.realized_val)
|
|||
|
||||
fprintf('RMSE of BVAR(%d):\n', nlags);
|
||||
|
||||
for i = 1:size(options_.varobs, 1)
|
||||
fprintf('%s: %10.4f\n', options_.varobs(i, :), rmse(i));
|
||||
for i = 1:length(options_.varobs)
|
||||
fprintf('%s: %10.4f\n', options_.varobs{i}, rmse(i));
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -161,8 +161,8 @@ if ~isdir(DirectoryName)
|
|||
end
|
||||
save([ DirectoryName '/simulations.mat'], 'sims_no_shock', 'sims_with_shocks');
|
||||
|
||||
for i = 1:size(options_.varobs, 1)
|
||||
name = options_.varobs(i, :);
|
||||
for i = 1:length(options_.varobs)
|
||||
name = options_.varobs{i};
|
||||
|
||||
sims = squeeze(sims_with_shocks(:,i,:));
|
||||
eval(['oo_.bvar.forecast.with_shocks.Mean.' name ' = mean(sims, 2);']);
|
||||
|
|
|
@ -138,9 +138,9 @@ save([ DirectoryName '/simulations.mat'], 'sampled_irfs');
|
|||
|
||||
% Save results in oo_
|
||||
for i=1:ny
|
||||
shock_name = options_.varobs(i, :);
|
||||
shock_name = options_.varobs{i};
|
||||
for j=1:ny
|
||||
variable_name = options_.varobs(j, :);
|
||||
variable_name = options_.varobs{j};
|
||||
eval(['oo_.bvar.irf.Mean.' variable_name '.' shock_name ' = posterior_mean_irfs(' int2str(j) ',' int2str(i) ',:);'])
|
||||
eval(['oo_.bvar.irf.Median.' variable_name '.' shock_name ' = posterior_median_irfs(' int2str(j) ',' int2str(i) ',:);'])
|
||||
eval(['oo_.bvar.irf.Var.' variable_name '.' shock_name ' = posterior_variance_irfs(' int2str(j) ',' int2str(i) ',:);'])
|
||||
|
|
|
@ -41,7 +41,7 @@ if options_.dsge_var && options_.bayesian_irf
|
|||
msg = 1;
|
||||
end
|
||||
end
|
||||
if size(varlist,1)~=size(options_.varobs)
|
||||
if size(varlist,1)~=length(options_.varobs)
|
||||
msg = 1;
|
||||
end
|
||||
if msg
|
||||
|
@ -50,7 +50,7 @@ if options_.dsge_var && options_.bayesian_irf
|
|||
disp(' ')
|
||||
end
|
||||
end
|
||||
varlist = options_.varobs;
|
||||
varlist = char(options_.varobs);
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -110,7 +110,7 @@ if isempty(varlist)
|
|||
if choice==1
|
||||
varlist = M_.endo_names(1:M_.orig_endo_nbr, :);
|
||||
elseif choice==2
|
||||
varlist = options_.varobs;
|
||||
varlist = char(options_.varobs);
|
||||
elseif choice==3
|
||||
varlist = NaN;
|
||||
else
|
||||
|
|
|
@ -36,14 +36,14 @@ function oo_ = compute_moments_varendo(type,options_,M_,oo_,var_list_)
|
|||
if strcmpi(type,'posterior')
|
||||
posterior = 1;
|
||||
if nargin==4
|
||||
var_list_ = options_.varobs;
|
||||
var_list_ = char(options_.varobs);
|
||||
end
|
||||
elseif strcmpi(type,'prior')
|
||||
posterior = 0;
|
||||
if nargin==4
|
||||
var_list_ = options_.prior_analysis_endo_var_list;
|
||||
if isempty(var_list_)
|
||||
options_.prior_analysis_var_list = options_.varobs;
|
||||
options_.prior_analysis_var_list = char(options_.varobs);
|
||||
end
|
||||
end
|
||||
else
|
||||
|
|
|
@ -38,7 +38,7 @@ dsge_prior_weight = M_.params(strmatch('dsge_prior_weight',M_.param_names));
|
|||
DSGE_PRIOR_WEIGHT = floor(gend*(1+dsge_prior_weight));
|
||||
|
||||
bvar.NumberOfLags = options_.varlag;
|
||||
bvar.NumberOfVariables = size(options_.varobs,1);
|
||||
bvar.NumberOfVariables = length(options_.varobs);
|
||||
bvar.Constant = 'no';
|
||||
bvar.NumberOfEstimatedParameters = bvar.NumberOfLags*bvar.NumberOfVariables;
|
||||
if ~options_.noconstant
|
||||
|
|
|
@ -81,8 +81,8 @@ switch task
|
|||
order_var = oo_.dr.order_var;
|
||||
i_var_obs = [];
|
||||
trend_coeffs = [];
|
||||
for i=1:size(var_obs,1)
|
||||
tmp = strmatch(var_obs(i,:),endo_names(i_var,:),'exact');
|
||||
for i=1:length(var_obs)
|
||||
tmp = strmatch(var_obs{i},endo_names(i_var,:),'exact');
|
||||
if ~isempty(tmp)
|
||||
i_var_obs = [ i_var_obs; tmp];
|
||||
trend_coeffs = [trend_coeffs; oo_.Smoother.TrendCoeffs(i)];
|
||||
|
|
|
@ -93,7 +93,7 @@ if nnobs > 1 && horizon > 0
|
|||
end
|
||||
|
||||
endo_names = M_.endo_names;
|
||||
n_varobs = size(options_.varobs,1);
|
||||
n_varobs = length(options_.varobs);
|
||||
|
||||
if isempty(var_list)
|
||||
var_list = endo_names;
|
||||
|
@ -116,7 +116,7 @@ if nnobs > 1 && horizon > 0
|
|||
IdObs = zeros(n_varobs,1);
|
||||
for j=1:n_varobs
|
||||
for i=1:nvar
|
||||
iobs = strmatch(options_.varobs(j,:),var_list,'exact');
|
||||
iobs = strmatch(options_.varobs{j},var_list,'exact');
|
||||
end
|
||||
if ~isempty(iobs)
|
||||
IdObs(j,1) = iobs;
|
||||
|
|
|
@ -103,7 +103,7 @@ missing_value = dataset_.missing.state;
|
|||
% Set number of observations
|
||||
gend = options_.nobs;
|
||||
% Set the number of observed variables.
|
||||
n_varobs = size(options_.varobs,1);
|
||||
n_varobs = length(options_.varobs);
|
||||
% Get the number of parameters to be estimated.
|
||||
nvx = estim_params_.nvx; % Variance of the structural innovations (number of parameters).
|
||||
nvn = estim_params_.nvn; % Variance of the measurement innovations (number of parameters).
|
||||
|
@ -572,7 +572,7 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
|
|||
disp(tit1)
|
||||
ip = nvx+1;
|
||||
for i=1:nvn
|
||||
name = deblank(options_.varobs(estim_params_.nvn_observable_correspondence(i,1),:));
|
||||
name = options_.varobs{estim_params_.nvn_observable_correspondence(i,1)};
|
||||
disp(sprintf('%-*s %7.3f %8.4f %7.4f %7.4f %4s %6.4f', ...
|
||||
header_width,name,bayestopt_.p1(ip), ...
|
||||
xparam1(ip),stdh(ip),tstath(ip), ...
|
||||
|
@ -671,7 +671,7 @@ elseif ~any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
|
|||
disp(tit1)
|
||||
ip = nvx+1;
|
||||
for i=1:nvn
|
||||
name = deblank(options_.varobs(estim_params_.nvn_observable_correspondence(i,1),:));
|
||||
name = options_.varobs{estim_params_.nvn_observable_correspondence(i,1)};
|
||||
disp(sprintf('%-*s %8.4f %7.4f %7.4f',header_width,name,xparam1(ip),stdh(ip),tstath(ip)))
|
||||
eval(['oo_.mle_mode.measurement_errors_std.' name ' = xparam1(ip);']);
|
||||
eval(['oo_.mle_std.measurement_errors_std.' name ' = stdh(ip);']);
|
||||
|
@ -817,7 +817,7 @@ if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior
|
|||
fprintf(fidTeX,'\\hline \\hline \\endlastfoot \n');
|
||||
ip = nvx+1;
|
||||
for i=1:nvn
|
||||
idx = strmatch(options_.varobs(estim_params_.nvn_observable_correspondence(i,1),:),M_.endo_names);
|
||||
idx = strmatch(options_.varobs{estim_params_.nvn_observable_correspondence(i,1)},M_.endo_names);
|
||||
fprintf(fidTeX,'$%s$ & %4s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n',...
|
||||
deblank(M_.endo_names_tex(idx,:)), ...
|
||||
deblank(pnames(bayestopt_.pshape(ip)+1,:)), ...
|
||||
|
@ -1106,8 +1106,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
number_of_plots_to_draw = number_of_plots_to_draw + 1;
|
||||
index = cat(1,index,i);
|
||||
end
|
||||
eval(['oo_.SmoothedMeasurementErrors.' deblank(options_.varobs(i,:)) ...
|
||||
' = measurement_error(i,:)'';']);
|
||||
eval(['oo_.SmoothedMeasurementErrors.' options_.varobs{i} ' = measurement_error(i,:)'';']);
|
||||
end
|
||||
if ~options_.nograph
|
||||
[nbplt,nr,nc,lr,lc,nstar] = pltorg(number_of_plots_to_draw);
|
||||
|
@ -1129,7 +1128,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
hold on
|
||||
plot(1:gend,measurement_error(index(k),:),'-k','linewidth',1)
|
||||
hold off
|
||||
name = deblank(options_.varobs(index(k),:));
|
||||
name = options_.varobs{index(k)};
|
||||
xlim([1 gend])
|
||||
if isempty(NAMES)
|
||||
NAMES = name;
|
||||
|
@ -1141,7 +1140,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
set(gca,'XTickLabel',options_.XTickLabel)
|
||||
end
|
||||
if options_.TeX
|
||||
idx = strmatch(options_.varobs(index(k),:),M_.endo_names,'exact');
|
||||
idx = strmatch(options_.varobs{index(k)},M_.endo_names,'exact');
|
||||
texname = M_.endo_names_tex(idx,:);
|
||||
if isempty(TeXNAMES)
|
||||
TeXNAMES = ['$ ' deblank(texname) ' $'];
|
||||
|
@ -1195,7 +1194,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
hold on
|
||||
plot(1:gend,rawdata(:,k),'--k','linewidth',1)
|
||||
hold off
|
||||
name = deblank(options_.varobs(k,:));
|
||||
name = options_.varobs{k};
|
||||
if isempty(NAMES)
|
||||
NAMES = name;
|
||||
else
|
||||
|
@ -1207,7 +1206,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
end
|
||||
xlim([1 gend])
|
||||
if options_.TeX
|
||||
idx = strmatch(options_.varobs(k,:),M_.endo_names,'exact');
|
||||
idx = strmatch(options_.varobs{k},M_.endo_names,'exact');
|
||||
texname = M_.endo_names_tex(idx,:);
|
||||
if isempty(TeXNAMES)
|
||||
TeXNAMES = ['$ ' deblank(texname) ' $'];
|
||||
|
|
|
@ -116,7 +116,7 @@ else
|
|||
end
|
||||
|
||||
% Set the number of observed variables.
|
||||
n_varobs = size(options_.varobs,1);
|
||||
n_varobs = length(options_.varobs);
|
||||
|
||||
% Set priors over the estimated parameters.
|
||||
if ~isempty(estim_params_)
|
||||
|
@ -223,8 +223,8 @@ end
|
|||
var_obs_index = [];
|
||||
k1 = [];
|
||||
for i=1:n_varobs
|
||||
var_obs_index = [var_obs_index; strmatch(deblank(options_.varobs(i,:)),M_.endo_names(dr.order_var,:),'exact')];
|
||||
k1 = [k1; strmatch(deblank(options_.varobs(i,:)),M_.endo_names, 'exact')];
|
||||
var_obs_index = [var_obs_index; strmatch(options_.varobs{i},M_.endo_names(dr.order_var,:),'exact')];
|
||||
k1 = [k1; strmatch(options_.varobs{i},M_.endo_names, 'exact')];
|
||||
end
|
||||
|
||||
% Define union of observed and state variables
|
||||
|
|
|
@ -132,7 +132,7 @@ options_.smoother=1;
|
|||
options_ident.analytic_derivation_mode = options_.analytic_derivation_mode;
|
||||
if isempty(dataset_),
|
||||
dataset_.info.ntobs = periods;
|
||||
dataset_.info.nvobs = rows(options_.varobs);
|
||||
dataset_.info.nvobs = length(options_.varobs);
|
||||
dataset_.info.varobs = options_.varobs;
|
||||
dataset_.rawdata = [];
|
||||
dataset_.missing.state = 0;
|
||||
|
@ -145,17 +145,8 @@ if isempty(dataset_),
|
|||
dataset_.missing.no_more_missing_observations = 1;
|
||||
dataset_.descriptive.mean = [];
|
||||
dataset_.data = [];
|
||||
|
||||
% data_info.gend = periods;
|
||||
% data_info.data = [];
|
||||
% data_info.data_index = [];
|
||||
% data_info.number_of_observations = periods*size(options_.varobs,1);
|
||||
% data_info.no_more_missing_observations = 0;
|
||||
% data_info.missing_value = 0;
|
||||
end
|
||||
|
||||
% results = prior_sampler(0,M_,bayestopt_,options_,oo_);
|
||||
|
||||
if prior_exist
|
||||
if any(bayestopt_.pshape > 0)
|
||||
if options_ident.prior_range
|
||||
|
|
|
@ -400,9 +400,9 @@ if options_gsa.glue,
|
|||
Obs.data = data;
|
||||
Obs.time = [1:gend];
|
||||
Obs.num = gend;
|
||||
for j=1:size(options_.varobs,1)
|
||||
Obs.name{j} = deblank(options_.varobs(j,:));
|
||||
vj=deblank(options_.varobs(j,:));
|
||||
for j=1:length(options_.varobs)
|
||||
Obs.name{j} = options_.varobs{j};
|
||||
vj = options_.varobs{j};
|
||||
|
||||
jxj = strmatch(vj,lgy_(dr_.order_var,:),'exact');
|
||||
js = strmatch(vj,lgy_,'exact');
|
||||
|
@ -440,7 +440,7 @@ if options_gsa.glue,
|
|||
ismoo(j)=jxj;
|
||||
|
||||
end
|
||||
jsmoo = size(options_.varobs,1);
|
||||
jsmoo = length(options_.varobs);
|
||||
for j=1:M_.endo_nbr,
|
||||
if ~ismember(j,ismoo),
|
||||
jsmoo=jsmoo+1;
|
||||
|
@ -465,10 +465,10 @@ if options_gsa.glue,
|
|||
Exo(j).name = deblank(tit(j,:));
|
||||
end
|
||||
if ~options_gsa.ppost
|
||||
Lik(size(options_.varobs,1)+1).name = 'logpo';
|
||||
Lik(size(options_.varobs,1)+1).ini = 'yes';
|
||||
Lik(size(options_.varobs,1)+1).isam = 1;
|
||||
Lik(size(options_.varobs,1)+1).data = -logpo2;
|
||||
Lik(length(options_.varobs)+1).name = 'logpo';
|
||||
Lik(length(options_.varobs)+1).ini = 'yes';
|
||||
Lik(length(options_.varobs)+1).isam = 1;
|
||||
Lik(length(options_.varobs)+1).data = -logpo2;
|
||||
end
|
||||
Sam.name = bayestopt_.name;
|
||||
Sam.dim = [size(x) 0];
|
||||
|
|
|
@ -24,10 +24,6 @@ nr = 3;
|
|||
exo_nbr = M_.exo_nbr;
|
||||
endo_names = M_.endo_names;
|
||||
fname = M_.fname;
|
||||
% $$$ varobs = options_.varobs;
|
||||
% $$$ y = oo_.SmoothedVariables;
|
||||
% $$$ ys = oo_.dr.ys;
|
||||
% $$$ gend = size(y,2);
|
||||
yf = oo_.forecast.Mean;
|
||||
hpdinf = oo_.forecast.HPDinf;
|
||||
hpdsup = oo_.forecast.HPDsup;
|
||||
|
@ -44,13 +40,6 @@ for i = 1:size(var_list)
|
|||
end
|
||||
nvar = length(i_var);
|
||||
|
||||
% $$$ % build trend for smoothed variables if necessary
|
||||
% $$$ trend = zeros(size(varobs,1),10);
|
||||
% $$$ if isfield(oo_.Smoother,'TrendCoeffs')
|
||||
% $$$ trend_coeffs = oo_.Smoother.TrendCoeffs;
|
||||
% $$$ trend = trend_coeffs*(gend-9:gend);
|
||||
% $$$ end
|
||||
|
||||
% create subdirectory <fname>/graphs if id doesn't exist
|
||||
if ~exist(fname, 'dir')
|
||||
mkdir('.',fname);
|
||||
|
|
|
@ -50,7 +50,7 @@ end
|
|||
|
||||
for i=1:nvn
|
||||
k1 = estim_params_.nvn_observable_correspondence(i,1);
|
||||
name1 = deblank(options_.varobs(k1,:));
|
||||
name1 = options_.varobs{k1};
|
||||
xparam(m) = eval(['oo_.posterior_' type '.measurement_errors_std.' name1]);
|
||||
m = m+1;
|
||||
end
|
||||
|
@ -69,8 +69,8 @@ end
|
|||
for i=1:ncn
|
||||
k1 = estim_params_.corrn_observable_correspondence(i,1);
|
||||
k2 = estim_params_.corrn_observable_correspondence(i,2);
|
||||
name1 = deblank(options_.varobs(k1,:));
|
||||
name2 = deblank(options_.varobs(k2,:));
|
||||
name1 = options_.varobs{k1};
|
||||
name2 = options_.varobs{k2};
|
||||
xparam(m) = eval(['oo_.posterior_' type '.measurement_errors_corr.' name1 '_' name2]);
|
||||
m = m+1;
|
||||
end
|
||||
|
|
|
@ -73,7 +73,7 @@ if k <= nvx
|
|||
texnam = ['$ SE_{' tname '} $'];
|
||||
end
|
||||
elseif k <= (nvx+nvn)
|
||||
vname = deblank(options_.varobs(estim_params_.nvn_observable_correspondence(k-estim_params_.nvx,1),:));
|
||||
vname = options_.varobs{estim_params_.nvn_observable_correspondence(k-estim_params_.nvx,1)};
|
||||
nam=['SE_EOBS_',vname];
|
||||
if TeX
|
||||
tname = deblank(M_.endo_names_tex(estim_params_.var_endo(k-estim_params_.nvx,1),:));
|
||||
|
|
|
@ -35,7 +35,7 @@ function [ivar,vartan,options_] = get_variables_list(options_,M_)
|
|||
|
||||
varlist = options_.varlist;
|
||||
if isempty(varlist)
|
||||
varlist = options_.varobs;
|
||||
varlist = char(options_.varobs);
|
||||
options_.varlist = varlist;
|
||||
end
|
||||
nvar = rows(varlist);
|
||||
|
|
|
@ -140,7 +140,7 @@ if info(1)==0,
|
|||
end
|
||||
analytic_derivation = options_.analytic_derivation;
|
||||
options_.analytic_derivation = -2;
|
||||
info = stoch_simul(options_.varobs);
|
||||
info = stoch_simul(char(options_.varobs));
|
||||
data_info.data=oo_.endo_simul(options_.varobs_id,100+1:end);
|
||||
% datax=data;
|
||||
derivatives_info.no_DLIK=1;
|
||||
|
|
|
@ -58,7 +58,7 @@ naK = length(options_.filter_step_ahead);
|
|||
MaxNumberOfBytes=options_.MaxNumberOfBytes;
|
||||
endo_nbr=M_.endo_nbr;
|
||||
exo_nbr=M_.exo_nbr;
|
||||
nvobs = size(options_.varobs,1);
|
||||
nvobs = length(options_.varobs);
|
||||
iendo = 1:endo_nbr;
|
||||
horizon = options_.forecast;
|
||||
% moments_varendo = options_.moments_varendo;
|
||||
|
@ -114,9 +114,9 @@ end
|
|||
MAX_nruns = min(B,ceil(MaxNumberOfBytes/(npar+2)/8));
|
||||
MAX_nsmoo = min(B,ceil(MaxNumberOfBytes/((endo_nbr)*gend)/8));
|
||||
MAX_ninno = min(B,ceil(MaxNumberOfBytes/(exo_nbr*gend)/8));
|
||||
MAX_nerro = min(B,ceil(MaxNumberOfBytes/(size(options_.varobs,1)*gend)/8));
|
||||
MAX_nerro = min(B,ceil(MaxNumberOfBytes/(length(options_.varobs)*gend)/8));
|
||||
if naK
|
||||
MAX_naK = min(B,ceil(MaxNumberOfBytes/(size(options_.varobs,1)* ...
|
||||
MAX_naK = min(B,ceil(MaxNumberOfBytes/(length(options_.varobs)* ...
|
||||
length(options_.filter_step_ahead)*gend)/8));
|
||||
end
|
||||
if horizon
|
||||
|
|
|
@ -42,7 +42,7 @@ if ~isempty(directory)
|
|||
end
|
||||
|
||||
dyn_size_01 = size(dyn_data_01,1);
|
||||
var_size_01 = size(var_names_01,1);
|
||||
var_size_01 = length(var_names_01);
|
||||
|
||||
% Auto-detect extension if not provided
|
||||
if isempty(extension)
|
||||
|
@ -71,7 +71,7 @@ switch (extension)
|
|||
case '.m'
|
||||
eval(basename);
|
||||
for dyn_i_01=1:var_size_01
|
||||
dyn_tmp_01 = eval(var_names_01(dyn_i_01,:));
|
||||
dyn_tmp_01 = eval(var_names_01{dyn_i_01});
|
||||
if length(dyn_tmp_01) > dyn_size_01 && dyn_size_01 > 0
|
||||
cd(old_pwd)
|
||||
error('data size is too large')
|
||||
|
@ -81,7 +81,7 @@ switch (extension)
|
|||
case '.mat'
|
||||
s = load(basename);
|
||||
for dyn_i_01=1:var_size_01
|
||||
dyn_tmp_01 = s.(deblank(var_names_01(dyn_i_01,:)));
|
||||
dyn_tmp_01 = s.(var_names_01{dyn_i_01});
|
||||
if length(dyn_tmp_01) > dyn_size_01 && dyn_size_01 > 0
|
||||
cd(old_pwd)
|
||||
error('data size is too large')
|
||||
|
@ -96,7 +96,7 @@ switch (extension)
|
|||
end
|
||||
end
|
||||
for dyn_i_01=1:var_size_01
|
||||
iv = strmatch(var_names_01(dyn_i_01,:),raw(1,:),'exact');
|
||||
iv = strmatch(var_names_01{dyn_i_01},raw(1,:),'exact');
|
||||
dyn_tmp_01 = [raw{2:end,iv}]';
|
||||
if length(dyn_tmp_01) > dyn_size_01 && dyn_size_01 > 0
|
||||
cd(old_pwd)
|
||||
|
@ -106,9 +106,8 @@ switch (extension)
|
|||
end
|
||||
case '.csv'
|
||||
[freq,init,data,varlist] = load_csv_file_data(fullname);
|
||||
%var_names_01 = deblank(var_names_01);
|
||||
for dyn_i_01=1:var_size_01
|
||||
iv = strmatch(strtrim(var_names_01(dyn_i_01,:)),varlist,'exact');
|
||||
iv = strmatch(var_names_01{dyn_i_01},varlist,'exact');
|
||||
if ~isempty(iv)
|
||||
dyn_tmp_01 = [data(2:end,iv)]';
|
||||
if length(dyn_tmp_01) > dyn_size_01 && dyn_size_01 > 0
|
||||
|
@ -118,7 +117,7 @@ switch (extension)
|
|||
dyn_data_01(:,dyn_i_01) = dyn_tmp_01;
|
||||
else
|
||||
cd(old_pwd)
|
||||
error([strtrim(var_names_01(dyn_i_01,:)) ' not found in ' fullname])
|
||||
error([var_names_01{dyn_i_01} ' not found in ' fullname])
|
||||
end
|
||||
end
|
||||
otherwise
|
||||
|
|
|
@ -76,11 +76,11 @@ end
|
|||
if nvn
|
||||
estim_params_.nvn_observable_correspondence=NaN(nvn,1); % stores number of corresponding observable
|
||||
if isequal(M_.H,0)
|
||||
nvarobs = size(options_.varobs,1);
|
||||
nvarobs = length(options_.varobs);
|
||||
M_.H = zeros(nvarobs,nvarobs);
|
||||
end
|
||||
for i=1:nvn
|
||||
obsi_ = strmatch(deblank(M_.endo_names(estim_params_.var_endo(i,1),:)),deblank(options_.varobs),'exact');
|
||||
obsi_ = strmatch(deblank(M_.endo_names(estim_params_.var_endo(i,1),:)),options_.varobs,'exact');
|
||||
if isempty(obsi_)
|
||||
error(['The variable ' deblank(M_.endo_names(estim_params_.var_endo(i,1),:)) ' has to be declared as observable since you assume a measurement error on it.'])
|
||||
end
|
||||
|
@ -95,7 +95,7 @@ if nvn
|
|||
bayestopt_.p3 = [ bayestopt_.p3; estim_params_.var_endo(:,8)];
|
||||
bayestopt_.p4 = [ bayestopt_.p4; estim_params_.var_endo(:,9)];
|
||||
bayestopt_.jscale = [ bayestopt_.jscale; estim_params_.var_endo(:,10)];
|
||||
bayestopt_.name = [ bayestopt_.name; cellstr(options_.varobs(estim_params_.nvn_observable_correspondence,:))];
|
||||
bayestopt_.name = [ bayestopt_.name; options_.varobs{estim_params_.nvn_observable_correspondence}];
|
||||
end
|
||||
if ncx
|
||||
xparam1 = [xparam1; estim_params_.corrx(:,3)];
|
||||
|
@ -114,7 +114,7 @@ end
|
|||
if ncn
|
||||
estim_params_.corrn_observable_correspondence=NaN(ncn,2);
|
||||
if isequal(M_.H,0)
|
||||
nvarobs = size(options_.varobs,1);
|
||||
nvarobs = length(options_.varobs);
|
||||
M_.H = zeros(nvarobs,nvarobs);
|
||||
end
|
||||
xparam1 = [xparam1; estim_params_.corrn(:,3)];
|
||||
|
@ -132,8 +132,8 @@ if ncn
|
|||
for i=1:ncn
|
||||
k1 = estim_params_.corrn(i,1);
|
||||
k2 = estim_params_.corrn(i,2);
|
||||
obsi1 = strmatch(deblank(M_.endo_names(k1,:)),deblank(options_.varobs),'exact'); %find correspondence to varobs to construct H in set_all_paramters
|
||||
obsi2 = strmatch(deblank(M_.endo_names(k2,:)),deblank(options_.varobs),'exact');
|
||||
obsi1 = strmatch(deblank(M_.endo_names(k1,:)),options_.varobs,'exact'); %find correspondence to varobs to construct H in set_all_paramters
|
||||
obsi2 = strmatch(deblank(M_.endo_names(k2,:)),options_.varobs,'exact');
|
||||
estim_params_.corrn_observable_correspondence(i,:)=[obsi1,obsi2]; %save correspondence
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ for j=1:replic;
|
|||
options_.noprint = 1;
|
||||
options_.order = 1;
|
||||
options_.periods = periods;
|
||||
info = stoch_simul(options_.varobs);
|
||||
info = stoch_simul(char(options_.varobs));
|
||||
dum=[oo_.mean; dyn_vech(oo_.var)];
|
||||
sd = sqrt(diag(oo_.var));
|
||||
for i=1:options_.ar;
|
||||
|
|
|
@ -102,7 +102,7 @@ if ~options_.noprint
|
|||
disp(' ')
|
||||
|
||||
if isfield(options_,'varobs')&& ~isempty(options_.varobs)
|
||||
PCL_varobs=options_.varobs;
|
||||
PCL_varobs=char(options_.varobs);
|
||||
disp('OBSERVED VARIABLES')
|
||||
else
|
||||
PCL_varobs=M_.endo_names;
|
||||
|
|
|
@ -20,8 +20,6 @@ function jndx = subset()
|
|||
global options_ estim_params_ M_
|
||||
|
||||
ExcludedParamNames = options_.ExcludedParams;
|
||||
VarObs = options_.varobs;
|
||||
VarExo = M_.exo_names;
|
||||
info = options_.ParamSubSet;
|
||||
|
||||
nvx = estim_params_.nvx;
|
||||
|
|
|
@ -43,7 +43,7 @@ end
|
|||
|
||||
% Fill the dataset structure
|
||||
dataset_.info.ntobs = nobs;
|
||||
dataset_.info.nvobs = rows(varobs);
|
||||
dataset_.info.nvobs = length(varobs);
|
||||
dataset_.info.varobs = varobs;
|
||||
|
||||
% Test the number of variables in the database.
|
||||
|
|
|
@ -75,7 +75,7 @@ YtX = [];
|
|||
XtY = [];
|
||||
XtX = [];
|
||||
|
||||
data = read_variables(datafile,varobs,[],xls_sheet,xls_range);
|
||||
data = read_variables(datafile,char(varobs),[],xls_sheet,xls_range);
|
||||
|
||||
if qlag > FirstObservation
|
||||
disp('VarSampleMoments :: not enough data to initialize! Try to increase FirstObservation.')
|
||||
|
@ -83,7 +83,7 @@ if qlag > FirstObservation
|
|||
end
|
||||
|
||||
NumberOfObservations = LastObservation-FirstObservation+1;% This is T.
|
||||
NumberOfVariables = size(varobs,1);% This is m.
|
||||
NumberOfVariables = length(varobs);% This is m.
|
||||
if var_trend_order == -1% No constant no linear trend case.
|
||||
X = zeros(NumberOfObservations,NumberOfVariables*qlag);
|
||||
elseif var_trend_order == 0% Constant and no linear trend case.
|
||||
|
|
Loading…
Reference in New Issue