method_of_moments: cosmetical changes to comments and messages
parent
7f60674dae
commit
37efafe475
|
@ -470,6 +470,6 @@ if options_mom_.mom.analytic_jacobian && ~strcmp(mom_method,'GMM')
|
||||||
end
|
end
|
||||||
if strcmp(options_mom_.mom.mom_method,'IRF_MATCHING')
|
if strcmp(options_mom_.mom.mom_method,'IRF_MATCHING')
|
||||||
if any(cellfun(@(x) isnumeric(x) && any(x == 13), options_mom_.optimizer_vec))
|
if any(cellfun(@(x) isnumeric(x) && any(x == 13), options_mom_.optimizer_vec))
|
||||||
error('method_of_moments: lsqnonlin (mode_compute=13) is not yet supported for IRF Matching!');
|
error('method_of_moments: lsqnonlin (mode_compute=13) is not yet supported for IRF matching!');
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -41,7 +41,7 @@ function display_comparison_moments_irfs(M_, options_mom_, data_moments, model_m
|
||||||
|
|
||||||
if strcmp(options_mom_.mom.mom_method,'IRF_MATCHING')
|
if strcmp(options_mom_.mom.mom_method,'IRF_MATCHING')
|
||||||
titl = upper('Comparison of matched data irfs and model irfs');
|
titl = upper('Comparison of matched data irfs and model irfs');
|
||||||
headers = {'Irf','Data','Model'};
|
headers = {'IRF','Data','Model'};
|
||||||
for jm = 1:size(M_.matched_irfs,1)
|
for jm = 1:size(M_.matched_irfs,1)
|
||||||
labels{jm,1} = [M_.endo_names{M_.matched_irfs{jm,1}(1)} ' ' M_.exo_names{M_.matched_irfs{jm,1}(2)} ' (' num2str(M_.matched_irfs{jm,1}(3)) ')'];
|
labels{jm,1} = [M_.endo_names{M_.matched_irfs{jm,1}(1)} ' ' M_.exo_names{M_.matched_irfs{jm,1}(2)} ' (' num2str(M_.matched_irfs{jm,1}(3)) ')'];
|
||||||
labels_TeX{jm,1} = [M_.endo_names_tex{M_.matched_irfs{jm,1}(1)} ' ' M_.exo_names_tex{M_.matched_irfs{jm,1}(2)} ' (' num2str(M_.matched_irfs{jm,1}(3)) ')'];
|
labels_TeX{jm,1} = [M_.endo_names_tex{M_.matched_irfs{jm,1}(1)} ' ' M_.exo_names_tex{M_.matched_irfs{jm,1}(2)} ' (' num2str(M_.matched_irfs{jm,1}(3)) ')'];
|
||||||
|
|
|
@ -70,7 +70,7 @@ for jexo = unique_shock_entries'
|
||||||
for jvar = 1:length(unique_variables)
|
for jvar = 1:length(unique_variables)
|
||||||
if jvar==1 || ~( (fig-1)*nstar<jvar && jvar<=fig*nstar )
|
if jvar==1 || ~( (fig-1)*nstar<jvar && jvar<=fig*nstar )
|
||||||
fig = fig+1;
|
fig = fig+1;
|
||||||
fig_irf = dyn_figure(nodisplay,'Name',['Irf matching shock to ' exo_names{jexo} ' figure ' int2str(fig)]);
|
fig_irf = dyn_figure(nodisplay,'Name',['IRF matching shock to ' exo_names{jexo} ' figure ' int2str(fig)]);
|
||||||
end
|
end
|
||||||
plt = jvar-(fig-1)*nstar;
|
plt = jvar-(fig-1)*nstar;
|
||||||
data_irf_rows = find(cellfun(@(x) x(1) == unique_variables(jvar) && x(2) == jexo, matched_irfs(:, 1)));
|
data_irf_rows = find(cellfun(@(x) x(1) == unique_variables(jvar) && x(2) == jexo, matched_irfs(:, 1)));
|
||||||
|
|
|
@ -15,8 +15,8 @@ function [data_irfs, weight_mat, irf_index, max_irf_horizon] = matched_irfs_bloc
|
||||||
% OUTPUT
|
% OUTPUT
|
||||||
% data_irfs: [matrix] irfs for VAROBS as declared in matched_irfs block
|
% data_irfs: [matrix] irfs for VAROBS as declared in matched_irfs block
|
||||||
% weight_mat: [matrix] weighting matrix for irfs as declared in matched_irfs_weight block
|
% weight_mat: [matrix] weighting matrix for irfs as declared in matched_irfs_weight block
|
||||||
% irf_index: [vector] index for selecting specific irfs from full irf matrix of observables
|
% irf_index: [vector] index for selecting specific irfs from full IRF matrix of observables
|
||||||
% max_irf_horizon: [scalar] maximum irf horizon as declared in matched_irfs block
|
% max_irf_horizon: [scalar] maximum IRF horizon as declared in matched_irfs block
|
||||||
% -------------------------------------------------------------------------
|
% -------------------------------------------------------------------------
|
||||||
% This function is called by
|
% This function is called by
|
||||||
% o mom.run
|
% o mom.run
|
||||||
|
@ -40,8 +40,8 @@ function [data_irfs, weight_mat, irf_index, max_irf_horizon] = matched_irfs_bloc
|
||||||
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
max_irf_horizon = max(cellfun(@(x) x(end), matched_irfs(:,1))); % get maximum irf horizon
|
max_irf_horizon = max(cellfun(@(x) x(end), matched_irfs(:,1))); % get maximum IRF horizon
|
||||||
% create full matrix where 1st dimension are irf periods, 2nd dimension are variables as declared in VAROBS, 3rd dimension are shocks.
|
% create full matrix where 1st dimension are IRF periods, 2nd dimension are variables as declared in VAROBS, 3rd dimension are shocks.
|
||||||
data_irfs = nan(max_irf_horizon,obs_nbr,exo_nbr);
|
data_irfs = nan(max_irf_horizon,obs_nbr,exo_nbr);
|
||||||
% overwrite nan values if they are declared in matched_irfs block; remaining nan values will be later ignored in the matching
|
% overwrite nan values if they are declared in matched_irfs block; remaining nan values will be later ignored in the matching
|
||||||
for jj = 1:size(matched_irfs,1)
|
for jj = 1:size(matched_irfs,1)
|
||||||
|
@ -52,7 +52,7 @@ for jj = 1:size(matched_irfs,1)
|
||||||
irf_value = matched_irfs{jj,2};
|
irf_value = matched_irfs{jj,2};
|
||||||
if isempty(id_varobs)
|
if isempty(id_varobs)
|
||||||
skipline;
|
skipline;
|
||||||
error('method_of_moments: You specified an irf matching involving variable %s, but it is not declared as a varobs!',endo_names{id_var})
|
error('method_of_moments: You specified an IRF matching involving variable %s, but it is not declared as a varobs!',endo_names{id_var})
|
||||||
end
|
end
|
||||||
data_irfs(id_irf_period,id_varobs,id_shock) = irf_value;
|
data_irfs(id_irf_period,id_varobs,id_shock) = irf_value;
|
||||||
end
|
end
|
||||||
|
@ -64,11 +64,11 @@ for jj = 1:size(matched_irfs_weight,1)
|
||||||
weight_mat_value = matched_irfs_weight{jj,3};
|
weight_mat_value = matched_irfs_weight{jj,3};
|
||||||
if isempty(id_varobs1)
|
if isempty(id_varobs1)
|
||||||
skipline;
|
skipline;
|
||||||
error('method_of_moments: You specified a weight for an irf matching involving variable %s, but it is not a varobs!',endo_names{id_var1})
|
error('method_of_moments: You specified a weight for an IRF matching involving variable %s, but it is not a varobs!',endo_names{id_var1})
|
||||||
end
|
end
|
||||||
if isempty(id_varobs2)
|
if isempty(id_varobs2)
|
||||||
skipline;
|
skipline;
|
||||||
error('method_of_moments: You specified a weight for an irf matching involving variable %s, but it is not a varobs!',endo_names{id_var2})
|
error('method_of_moments: You specified a weight for an IRF matching involving variable %s, but it is not a varobs!',endo_names{id_var2})
|
||||||
end
|
end
|
||||||
idweight_mat1 = sub2ind(size(data_irfs),id_irf_period1,id_varobs1,id_shock1);
|
idweight_mat1 = sub2ind(size(data_irfs),id_irf_period1,id_varobs1,id_shock1);
|
||||||
idweight_mat2 = sub2ind(size(data_irfs),id_irf_period2,id_varobs2,id_shock2);
|
idweight_mat2 = sub2ind(size(data_irfs),id_irf_period2,id_varobs2,id_shock2);
|
||||||
|
|
|
@ -302,7 +302,7 @@ if strcmp(options_mom_.mom.mom_method,'IRF_MATCHING') && strcmp(options_mom_.mom
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
irf_model_varobs = model_irf(:,options_mom_.varobs_id,:); % focus only on observables (this will be used later for plotting)
|
irf_model_varobs = model_irf(:,options_mom_.varobs_id,:); % focus only on observables (this will be used later for plotting)
|
||||||
model_moments = irf_model_varobs(options_mom_.mom.irfIndex); % focus only on selected irf periods
|
model_moments = irf_model_varobs(options_mom_.mom.irfIndex); % focus only on selected IRF periods
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue