Manually merged PR #1022.
commit
1fa050830b
|
@ -2189,7 +2189,7 @@ possible types of simulations in stochastic mode:
|
||||||
@itemize
|
@itemize
|
||||||
|
|
||||||
@item
|
@item
|
||||||
@ref{stoch_simul}, if the @code{periods} options is specified
|
@ref{stoch_simul}, if the @code{periods} option is specified
|
||||||
|
|
||||||
@item
|
@item
|
||||||
@ref{forecast} as the initial point at which the forecasts are computed
|
@ref{forecast} as the initial point at which the forecasts are computed
|
||||||
|
@ -2419,7 +2419,7 @@ Moreover, as only states enter the recursive policy functions, all values specif
|
||||||
@itemize
|
@itemize
|
||||||
|
|
||||||
@item
|
@item
|
||||||
in @ref{stoch_simul}, if the @code{periods} options is specified. Note that this only affects the starting point for the simulation, but not for the impulse response functions.
|
in @ref{stoch_simul}, if the @code{periods} option is specified. Note that this only affects the starting point for the simulation, but not for the impulse response functions.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
in @ref{forecast} as the initial point at which the forecasts are computed
|
in @ref{forecast} as the initial point at which the forecasts are computed
|
||||||
|
@ -3925,6 +3925,11 @@ Tolerance for the suppression of small terms in the display of decision rules. R
|
||||||
smaller than @code{dr_display_tol} are not displayed.
|
smaller than @code{dr_display_tol} are not displayed.
|
||||||
Default value: @code{1e-6}.
|
Default value: @code{1e-6}.
|
||||||
|
|
||||||
|
@item contemporaneous_correlation
|
||||||
|
@anchor{contemporaneous_correlation}
|
||||||
|
Saves the contemporaneous correlation between the endogenous variables in @code{oo_.contemporaneous_correlation}.
|
||||||
|
Requires the @code{nocorr}-option not to be set.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@outputhead
|
@outputhead
|
||||||
|
@ -3942,6 +3947,8 @@ If options @code{irf} is different from zero, sets @code{oo_.irfs}
|
||||||
the global workspace (this latter way of accessing the IRFs is
|
the global workspace (this latter way of accessing the IRFs is
|
||||||
deprecated and will disappear in a future version).
|
deprecated and will disappear in a future version).
|
||||||
|
|
||||||
|
If the option @code{contemporaneous_correlation} is different from 0, sets
|
||||||
|
@code{oo_.contemporaneous_correlation}, which is described below.
|
||||||
|
|
||||||
@customhead{Example 1}
|
@customhead{Example 1}
|
||||||
|
|
||||||
|
@ -3971,14 +3978,15 @@ response functions on 60 periods for variables @code{y} and @code{k}.
|
||||||
@defvr {MATLAB/Octave variable} oo_.mean
|
@defvr {MATLAB/Octave variable} oo_.mean
|
||||||
After a run of @code{stoch_simul}, contains the mean of the endogenous
|
After a run of @code{stoch_simul}, contains the mean of the endogenous
|
||||||
variables. Contains theoretical mean if the @code{periods} option is
|
variables. Contains theoretical mean if the @code{periods} option is
|
||||||
not present, and empirical mean otherwise. The variables are arranged
|
not present, and simulated mean otherwise. The variables are arranged
|
||||||
in declaration order.
|
in declaration order.
|
||||||
@end defvr
|
@end defvr
|
||||||
|
|
||||||
@defvr {MATLAB/Octave variable} oo_.var
|
@defvr {MATLAB/Octave variable} oo_.var
|
||||||
After a run of @code{stoch_simul}, contains the variance-covariance of
|
After a run of @code{stoch_simul}, contains the variance-covariance of
|
||||||
the endogenous variables. Contains theoretical variance if the
|
the endogenous variables. Contains theoretical variance if the
|
||||||
@code{periods} option is not present (or an approximation thereof for @code{order=2}), and empirical variance
|
@code{periods} option is not present (or an approximation thereof for @code{order=2}),
|
||||||
|
and simulated variance
|
||||||
otherwise. The variables are arranged in declaration order.
|
otherwise. The variables are arranged in declaration order.
|
||||||
@end defvr
|
@end defvr
|
||||||
|
|
||||||
|
@ -3990,7 +3998,7 @@ number of the matrix in the cell array corresponds to the order of
|
||||||
autocorrelation. The option @code{ar} specifies the number of
|
autocorrelation. The option @code{ar} specifies the number of
|
||||||
autocorrelation matrices available. Contains theoretical
|
autocorrelation matrices available. Contains theoretical
|
||||||
autocorrelations if the @code{periods} option is not present (or an approximation thereof for @code{order=2}), and
|
autocorrelations if the @code{periods} option is not present (or an approximation thereof for @code{order=2}), and
|
||||||
empirical autocorrelations otherwise. The field is only created if stationary variables are present.
|
simulated autocorrelations otherwise. The field is only created if stationary variables are present.
|
||||||
|
|
||||||
The element @code{oo_.autocorr@{i@}(k,l)} is equal to the correlation
|
The element @code{oo_.autocorr@{i@}(k,l)} is equal to the correlation
|
||||||
between @math{y^k_t} and @math{y^l_{t-i}}, where @math{y^k}
|
between @math{y^k_t} and @math{y^l_{t-i}}, where @math{y^k}
|
||||||
|
@ -4024,13 +4032,18 @@ If a second order approximation has been requested, contains the
|
||||||
vector of the mean correction terms.
|
vector of the mean correction terms.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
In case of @code{order=2}, the theoretical second moments are a second order accurate approximation of the true second moments, see @code{conditional_variance_decomposition}.
|
In case of @code{order=2}, the theoretical second moments are a second order
|
||||||
|
accurate approximation of the true second moments, see @code{conditional_variance_decomposition}.
|
||||||
|
|
||||||
@end defvr
|
@end defvr
|
||||||
|
|
||||||
@anchor{oo_.variance_decomposition}
|
@anchor{oo_.variance_decomposition}
|
||||||
@defvr {MATLAB/Octave variable} oo_.variance_decomposition
|
@defvr {MATLAB/Octave variable} oo_.variance_decomposition
|
||||||
After a run of @code{stoch_simul} when requesting theoretical moments (@code{periods=0}), contains a matrix with the result of the unconditional variance decomposition (i.e. at horizon infinity). The first dimension corresponds to the endogenous variables (in the order of declaration) and the second dimension corresponds to exogenous variables (in the order of declaration). Numbers are in percent and sum up to 100 across columns.
|
After a run of @code{stoch_simul} when requesting theoretical moments (@code{periods=0}),
|
||||||
|
contains a matrix with the result of the unconditional variance decomposition (i.e. at horizon infinity).
|
||||||
|
The first dimension corresponds to the endogenous variables (in the order of declaration) and
|
||||||
|
the second dimension corresponds to exogenous variables (in the order of declaration).
|
||||||
|
Numbers are in percent and sum up to 100 across columns.
|
||||||
@end defvr
|
@end defvr
|
||||||
|
|
||||||
@anchor{oo_.conditional_variance_decomposition}
|
@anchor{oo_.conditional_variance_decomposition}
|
||||||
|
@ -4044,6 +4057,15 @@ the order of declaration), the third dimension corresponds to
|
||||||
exogenous variables (in the order of declaration).
|
exogenous variables (in the order of declaration).
|
||||||
@end defvr
|
@end defvr
|
||||||
|
|
||||||
|
@anchor{oo_.contemporaneous_correlation}
|
||||||
|
@defvr {MATLAB/Octave variable} oo_.contemporaneous_correlation
|
||||||
|
After a run of @code{stoch_simul} with the
|
||||||
|
@code{contemporaneous_correlation} option, contains theoretical contemporaneous correlations if the
|
||||||
|
@code{periods} option is not present (or an approximation thereof for @code{order=2}),
|
||||||
|
and simulated contemporaneous correlations otherwise. The variables are arranged in declaration order.
|
||||||
|
@end defvr
|
||||||
|
|
||||||
|
|
||||||
@defvr {MATLAB/Octave variable} oo_.irfs
|
@defvr {MATLAB/Octave variable} oo_.irfs
|
||||||
After a run of @code{stoch_simul} with option @code{irf} different
|
After a run of @code{stoch_simul} with option @code{irf} different
|
||||||
from zero, contains the impulse responses, with the following naming
|
from zero, contains the impulse responses, with the following naming
|
||||||
|
@ -5380,6 +5402,10 @@ variables. Results are stored in
|
||||||
@code{oo_.PosteriorTheoreticalMoments} (@pxref{oo_.PosteriorTheoreticalMoments}). The number of lags in the autocorrelation function is
|
@code{oo_.PosteriorTheoreticalMoments} (@pxref{oo_.PosteriorTheoreticalMoments}). The number of lags in the autocorrelation function is
|
||||||
controlled by the @code{ar} option.
|
controlled by the @code{ar} option.
|
||||||
|
|
||||||
|
@item contemporaneous_correlation
|
||||||
|
@xref{contemporaneous_correlation}. Results are stored in @code{oo_.PosteriorTheoreticalMoments}.
|
||||||
|
Note that the @code{nocorr}-option has no effect.
|
||||||
|
|
||||||
@item conditional_variance_decomposition = @var{INTEGER}
|
@item conditional_variance_decomposition = @var{INTEGER}
|
||||||
See below.
|
See below.
|
||||||
|
|
||||||
|
@ -5924,6 +5950,9 @@ where @var{THEORETICAL_MOMENT} is one of the following:
|
||||||
@item covariance
|
@item covariance
|
||||||
Variance-covariance of endogenous variables
|
Variance-covariance of endogenous variables
|
||||||
|
|
||||||
|
@item contemporaneous_correlation
|
||||||
|
Contemporaneous correlation of endogenous variables when the @ref{contemporaneous_correlation} option is specified.
|
||||||
|
|
||||||
@item correlation
|
@item correlation
|
||||||
Auto- and cross-correlation of endogenous variables. Fields are vectors with correlations from 1 up to order @code{options_.ar}
|
Auto- and cross-correlation of endogenous variables. Fields are vectors with correlations from 1 up to order @code{options_.ar}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,23 @@
|
||||||
function [info,description] = check_posterior_analysis_data(type,M_)
|
function [info,description] = check_posterior_analysis_data(type,M_)
|
||||||
|
% function [info,description] = check_posterior_analysis_data(type,M_)
|
||||||
|
% Checks the status of posterior analysis and in particular if files need to be
|
||||||
|
% created or updated; called by posterior_analysis.m
|
||||||
|
%
|
||||||
|
% Inputs:
|
||||||
|
% type [string] name of the posterior moment considered
|
||||||
|
% M_ [structure] Dynare model structure
|
||||||
|
%
|
||||||
|
% Outputs:
|
||||||
|
% info [scalar] return code
|
||||||
|
% info = 1; % select_posterior_draws has to be called first.
|
||||||
|
% info = 2; % _posterior_draws files have to be updated.
|
||||||
|
% info = 3; % Ok! posterior draws files are up to date ;
|
||||||
|
% info = 4; % posterior draws have to be processed.
|
||||||
|
% info = 5; % posterior data files have to be updated.
|
||||||
|
% info = 6; % Ok (nothing to do ;-)
|
||||||
|
% description [string] Message corresponding to info
|
||||||
|
|
||||||
% Copyright (C) 2008-2013 Dynare Team
|
% Copyright (C) 2008-2015 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
|
|
@ -1,4 +1,23 @@
|
||||||
function [info,description] = check_prior_analysis_data(type,M_)
|
function [info,description] = check_prior_analysis_data(type,M_)
|
||||||
|
% function [info,description] = check_prior_analysis_data(type,M_)
|
||||||
|
% Checks the status of prior analysis and in particular if files need to be
|
||||||
|
% created or updated; called by prior_analysis.m
|
||||||
|
%
|
||||||
|
% Inputs:
|
||||||
|
% type [string] name of the posterior moment considered
|
||||||
|
% M_ [structure] Dynare model structure
|
||||||
|
%
|
||||||
|
% Outputs:
|
||||||
|
% info [scalar] return code
|
||||||
|
% info = 1; % prior_sampler has to be called first.
|
||||||
|
% info = 2; % _prior_draws files have to be updated.
|
||||||
|
% info = 3; % Ok! prior draws files are up to date ;
|
||||||
|
% info = 4; % prior draws have to be processed.
|
||||||
|
% info = 5; % prior data files have to be updated.
|
||||||
|
% info = 6; % Ok (nothing to do ;-)
|
||||||
|
% description [string] Message corresponding to info
|
||||||
|
|
||||||
|
|
||||||
% Copyright (C) 2009-2011 Dynare Team
|
% Copyright (C) 2009-2011 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
|
@ -28,7 +47,6 @@ if ~exist([ M_.dname '/prior/draws'],'dir')
|
||||||
end
|
end
|
||||||
|
|
||||||
prior_draws_info = dir([ M_.dname '/prior/draws/prior_draws*.mat']);
|
prior_draws_info = dir([ M_.dname '/prior/draws/prior_draws*.mat']);
|
||||||
name_of_the_last_prior_draw_file = prior_draws_info(end).name;
|
|
||||||
date_of_the_last_prior_draw_file = prior_draws_info(end).datenum;
|
date_of_the_last_prior_draw_file = prior_draws_info(end).datenum;
|
||||||
|
|
||||||
%% Get informations about _posterior_draws files.
|
%% Get informations about _posterior_draws files.
|
||||||
|
@ -39,7 +57,6 @@ if isempty(prior_draws_info)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
number_of_last_prior_draws_file = length(prior_draws_info);
|
|
||||||
date_of_the_prior_definition = get_date_of_a_file([ M_.dname '/prior/definition.mat']);
|
date_of_the_prior_definition = get_date_of_a_file([ M_.dname '/prior/definition.mat']);
|
||||||
if date_of_the_prior_definition>date_of_the_last_prior_draw_file
|
if date_of_the_prior_definition>date_of_the_last_prior_draw_file
|
||||||
info = 2;
|
info = 2;
|
||||||
|
|
|
@ -33,6 +33,9 @@ function oo_ = compute_moments_varendo(type,options_,M_,oo_,var_list_)
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
fprintf('Estimation::compute_moments_varendo: I''m computing endogenous moments (this may take a while)... ');
|
||||||
|
|
||||||
if strcmpi(type,'posterior')
|
if strcmpi(type,'posterior')
|
||||||
posterior = 1;
|
posterior = 1;
|
||||||
if nargin==4
|
if nargin==4
|
||||||
|
@ -47,13 +50,11 @@ elseif strcmpi(type,'prior')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
disp('compute_moments_varendo:: Unknown type!')
|
error('compute_moments_varendo:: Unknown type!')
|
||||||
error()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
NumberOfEndogenousVariables = rows(var_list_);
|
NumberOfEndogenousVariables = rows(var_list_);
|
||||||
NumberOfExogenousVariables = M_.exo_nbr;
|
NumberOfExogenousVariables = M_.exo_nbr;
|
||||||
list_of_exogenous_variables = M_.exo_names;
|
|
||||||
NumberOfLags = options_.ar;
|
NumberOfLags = options_.ar;
|
||||||
NoDecomposition = options_.nodecomposition;
|
NoDecomposition = options_.nodecomposition;
|
||||||
if isfield(options_,'conditional_variance_decomposition')
|
if isfield(options_,'conditional_variance_decomposition')
|
||||||
|
@ -128,3 +129,5 @@ if M_.exo_nbr > 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fprintf(' Done!\n');
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function oo_ = covariance_mc_analysis(NumberOfSimulations,type,dname,fname,vartan,nvar,var1,var2,mh_conf_sig,oo_)
|
function oo_ = covariance_mc_analysis(NumberOfSimulations,type,dname,fname,vartan,nvar,var1,var2,mh_conf_sig,oo_,options_)
|
||||||
% This function analyses the (posterior or prior) distribution of the
|
% This function analyses the (posterior or prior) distribution of the
|
||||||
% endogenous variables' covariance matrix.
|
% endogenous variables' covariance matrix.
|
||||||
%
|
%
|
||||||
|
@ -14,6 +14,7 @@ function oo_ = covariance_mc_analysis(NumberOfSimulations,type,dname,fname,varta
|
||||||
% mh_conf_sig [double] 2 by 1 vector with upper
|
% mh_conf_sig [double] 2 by 1 vector with upper
|
||||||
% and lower bound of HPD intervals
|
% and lower bound of HPD intervals
|
||||||
% oo_ [structure] Dynare structure where the results are saved.
|
% oo_ [structure] Dynare structure where the results are saved.
|
||||||
|
% options_ [structure] Dynare options structure
|
||||||
%
|
%
|
||||||
% OUTPUTS
|
% OUTPUTS
|
||||||
% oo_ [structure] Dynare structure where the results are saved.
|
% oo_ [structure] Dynare structure where the results are saved.
|
||||||
|
@ -86,10 +87,21 @@ end
|
||||||
|
|
||||||
ListOfFiles = dir([ PATH fname '_' TYPE '2ndOrderMoments*.mat']);
|
ListOfFiles = dir([ PATH fname '_' TYPE '2ndOrderMoments*.mat']);
|
||||||
i1 = 1; tmp = zeros(NumberOfSimulations,1);
|
i1 = 1; tmp = zeros(NumberOfSimulations,1);
|
||||||
|
if options_.contemporaneous_correlation
|
||||||
|
tmp_corr_mat = zeros(NumberOfSimulations,1);
|
||||||
|
cov_pos=symmetric_matrix_index(indx1,indx2,nvar);
|
||||||
|
var_pos_1=symmetric_matrix_index(indx1,indx1,nvar);
|
||||||
|
var_pos_2=symmetric_matrix_index(indx2,indx2,nvar);
|
||||||
|
end
|
||||||
for file = 1:length(ListOfFiles)
|
for file = 1:length(ListOfFiles)
|
||||||
load([ PATH ListOfFiles(file).name ]);
|
load([ PATH ListOfFiles(file).name ]);
|
||||||
i2 = i1 + rows(Covariance_matrix) - 1;
|
i2 = i1 + rows(Covariance_matrix) - 1;
|
||||||
tmp(i1:i2) = Covariance_matrix(:,symmetric_matrix_index(indx1,indx2,nvar));
|
tmp(i1:i2) = Covariance_matrix(:,symmetric_matrix_index(indx1,indx2,nvar));
|
||||||
|
if options_.contemporaneous_correlation
|
||||||
|
temp=Covariance_matrix(:,cov_pos)./(sqrt(Covariance_matrix(:,var_pos_1)).*sqrt(Covariance_matrix(:,var_pos_2)));
|
||||||
|
temp(Covariance_matrix(:,cov_pos)==0)=0; %filter out 0 correlations that would result in 0/0
|
||||||
|
tmp_corr_mat(i1:i2)=temp;
|
||||||
|
end
|
||||||
i1 = i2+1;
|
i1 = i2+1;
|
||||||
end
|
end
|
||||||
name = [var1 '.' var2];
|
name = [var1 '.' var2];
|
||||||
|
@ -111,4 +123,16 @@ else
|
||||||
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.covariance.HPDsup.' name ' = NaN;']);
|
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.covariance.HPDsup.' name ' = NaN;']);
|
||||||
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.covariance.deciles.' name ' = NaN;']);
|
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.covariance.deciles.' name ' = NaN;']);
|
||||||
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.covariance.density.' name ' = NaN;']);
|
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.covariance.density.' name ' = NaN;']);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if options_.contemporaneous_correlation
|
||||||
|
[p_mean, p_median, p_var, hpd_interval, p_deciles, density] = ...
|
||||||
|
posterior_moments(tmp_corr_mat,1,mh_conf_sig);
|
||||||
|
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.contemporeaneous_correlation.Mean.' name ' = p_mean;']);
|
||||||
|
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.contemporeaneous_correlation.Median.' name ' = p_median;']);
|
||||||
|
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.contemporeaneous_correlation.Variance.' name ' = p_var;']);
|
||||||
|
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.contemporeaneous_correlation.HPDinf.' name ' = hpd_interval(1);']);
|
||||||
|
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.contemporeaneous_correlation.HPDsup.' name ' = hpd_interval(2);']);
|
||||||
|
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.contemporeaneous_correlation.deciles.' name ' = p_deciles;']);
|
||||||
|
eval(['oo_.' TYPE 'TheoreticalMoments.dsge.contemporeaneous_correlation.density.' name ' = density;']);
|
||||||
|
end
|
||||||
|
|
|
@ -69,6 +69,9 @@ end
|
||||||
|
|
||||||
if options_.nocorr == 0
|
if options_.nocorr == 0
|
||||||
corr = (y'*y/size(y,1))./(s'*s);
|
corr = (y'*y/size(y,1))./(s'*s);
|
||||||
|
if options_.contemporaneous_correlation
|
||||||
|
oo_.contemporaneous_correlation = corr;
|
||||||
|
end
|
||||||
if options_.noprint == 0
|
if options_.noprint == 0
|
||||||
title = 'CORRELATION OF SIMULATED VARIABLES';
|
title = 'CORRELATION OF SIMULATED VARIABLES';
|
||||||
if options_.hp_filter
|
if options_.hp_filter
|
||||||
|
|
|
@ -117,6 +117,9 @@ end
|
||||||
|
|
||||||
if options_.nocorr == 0 && size(stationary_vars, 1) > 0
|
if options_.nocorr == 0 && size(stationary_vars, 1) > 0
|
||||||
corr = oo_.gamma_y{1}(i1,i1)./(sd(i1)*sd(i1)');
|
corr = oo_.gamma_y{1}(i1,i1)./(sd(i1)*sd(i1)');
|
||||||
|
if options_.contemporaneous_correlation
|
||||||
|
oo_.contemporaneous_correlation = corr;
|
||||||
|
end
|
||||||
if ~options_.noprint,
|
if ~options_.noprint,
|
||||||
skipline()
|
skipline()
|
||||||
if options_.order == 2
|
if options_.order == 2
|
||||||
|
|
|
@ -480,6 +480,7 @@ end
|
||||||
options_.filter_covariance = 0;
|
options_.filter_covariance = 0;
|
||||||
options_.filter_decomposition = 0;
|
options_.filter_decomposition = 0;
|
||||||
options_.selected_variables_only = 0;
|
options_.selected_variables_only = 0;
|
||||||
|
options_.contemporaneous_correlation = 0;
|
||||||
options_.initialize_estimated_parameters_with_the_prior_mode = 0;
|
options_.initialize_estimated_parameters_with_the_prior_mode = 0;
|
||||||
options_.estimation_dll = 0;
|
options_.estimation_dll = 0;
|
||||||
% Misc
|
% Misc
|
||||||
|
|
|
@ -87,7 +87,7 @@ if ~options_.load_mh_file && ~options_.mh_recover
|
||||||
if nblck > 1
|
if nblck > 1
|
||||||
disp('Estimation::mcmc: Multiple chains mode.')
|
disp('Estimation::mcmc: Multiple chains mode.')
|
||||||
else
|
else
|
||||||
disp('Etimation::mcmc: One Chain mode.')
|
disp('Estimation::mcmc: One Chain mode.')
|
||||||
end
|
end
|
||||||
% Delete old mh files if any...
|
% Delete old mh files if any...
|
||||||
files = dir([BaseName '_mh*_blck*.mat']);
|
files = dir([BaseName '_mh*_blck*.mat']);
|
||||||
|
|
|
@ -55,7 +55,7 @@ switch type
|
||||||
dsge_simulated_theoretical_covariance(SampleSize,M_,options_,oo_,'posterior');
|
dsge_simulated_theoretical_covariance(SampleSize,M_,options_,oo_,'posterior');
|
||||||
end
|
end
|
||||||
oo_ = covariance_mc_analysis(SampleSize,'posterior',M_.dname,M_.fname,...
|
oo_ = covariance_mc_analysis(SampleSize,'posterior',M_.dname,M_.fname,...
|
||||||
vartan,nvar,arg1,arg2,options_.mh_conf_sig,oo_);
|
vartan,nvar,arg1,arg2,options_.mh_conf_sig,oo_,options_);
|
||||||
case 'decomposition'
|
case 'decomposition'
|
||||||
if nargin==narg1
|
if nargin==narg1
|
||||||
[nvar,vartan,NumberOfFiles] = ...
|
[nvar,vartan,NumberOfFiles] = ...
|
||||||
|
|
|
@ -56,7 +56,7 @@ switch type
|
||||||
dsge_simulated_theoretical_covariance(SampleSize,M_,options_,oo_,'prior');
|
dsge_simulated_theoretical_covariance(SampleSize,M_,options_,oo_,'prior');
|
||||||
end
|
end
|
||||||
oo_ = covariance_mc_analysis(SampleSize,'prior',M_.dname,M_.fname,...
|
oo_ = covariance_mc_analysis(SampleSize,'prior',M_.dname,M_.fname,...
|
||||||
vartan,nvar,arg1,arg2,options_.mh_conf_sig,oo_);
|
vartan,nvar,arg1,arg2,options_.mh_conf_sig,oo_,options_);
|
||||||
case 'decomposition'
|
case 'decomposition'
|
||||||
if nargin==narg1
|
if nargin==narg1
|
||||||
[nvar,vartan,NumberOfFiles] = ...
|
[nvar,vartan,NumberOfFiles] = ...
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
function k = symmetric_matrix_index(i,j,n)
|
function k = symmetric_matrix_index(i,j,n)
|
||||||
|
% function k = symmetric_matrix_index(i,j,n)
|
||||||
|
% Returns index number of variable combination (i,j) in vech(A) where A is
|
||||||
|
% an symmetric n by n matrix and vech creates row vector by stacking rows
|
||||||
|
% of A on and above the diagonal
|
||||||
|
%
|
||||||
|
% Inputs:
|
||||||
|
% i [scalar] index of first variable
|
||||||
|
% j [scalar] index of second variable
|
||||||
|
% n [scalar] number of variables
|
||||||
|
% Outputs:
|
||||||
|
% k [scalar] index of variable combination in vech(A)
|
||||||
|
|
||||||
% Copyright (C) 2007-2009 Dynare Team
|
% Copyright (C) 2007-2015 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
|
|
@ -106,7 +106,7 @@ class ParsingDriver;
|
||||||
%token LYAPUNOV_FIXED_POINT_TOL LYAPUNOV_DOUBLING_TOL LYAPUNOV_SQUARE_ROOT_SOLVER_TOL LOG_DEFLATOR LOG_TREND_VAR LOG_GROWTH_FACTOR MARKOWITZ MARGINAL_DENSITY MAX MAXIT
|
%token LYAPUNOV_FIXED_POINT_TOL LYAPUNOV_DOUBLING_TOL LYAPUNOV_SQUARE_ROOT_SOLVER_TOL LOG_DEFLATOR LOG_TREND_VAR LOG_GROWTH_FACTOR MARKOWITZ MARGINAL_DENSITY MAX MAXIT
|
||||||
%token MFS MH_CONF_SIG MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER POSTERIOR_MAX_SUBSAMPLE_DRAWS MIN MINIMAL_SOLVING_PERIODS
|
%token MFS MH_CONF_SIG MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER POSTERIOR_MAX_SUBSAMPLE_DRAWS MIN MINIMAL_SOLVING_PERIODS
|
||||||
%token MODE_CHECK MODE_CHECK_NEIGHBOURHOOD_SIZE MODE_CHECK_SYMMETRIC_PLOTS MODE_CHECK_NUMBER_OF_POINTS MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS ABS SIGN
|
%token MODE_CHECK MODE_CHECK_NEIGHBOURHOOD_SIZE MODE_CHECK_SYMMETRIC_PLOTS MODE_CHECK_NUMBER_OF_POINTS MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS ABS SIGN
|
||||||
%token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS TAPER_STEPS GEWEKE_INTERVAL MCMC_JUMPING_COVARIANCE MOMENT_CALIBRATION
|
%token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO CONTEMPORANEOUS_CORRELATION DIFFUSE_FILTER SUB_DRAWS TAPER_STEPS GEWEKE_INTERVAL MCMC_JUMPING_COVARIANCE MOMENT_CALIBRATION
|
||||||
%token NUMBER_OF_PARTICLES RESAMPLING SYSTEMATIC GENERIC RESAMPLING_THRESHOLD RESAMPLING_METHOD KITAGAWA STRATIFIED SMOOTH
|
%token NUMBER_OF_PARTICLES RESAMPLING SYSTEMATIC GENERIC RESAMPLING_THRESHOLD RESAMPLING_METHOD KITAGAWA STRATIFIED SMOOTH
|
||||||
%token FILTER_ALGORITHM PROPOSAL_APPROXIMATION CUBATURE UNSCENTED MONTECARLO DISTRIBUTION_APPROXIMATION
|
%token FILTER_ALGORITHM PROPOSAL_APPROXIMATION CUBATURE UNSCENTED MONTECARLO DISTRIBUTION_APPROXIMATION
|
||||||
%token <string_val> NAME
|
%token <string_val> NAME
|
||||||
|
@ -1068,6 +1068,7 @@ stoch_simul_primary_options : o_dr_algo
|
||||||
| o_drop
|
| o_drop
|
||||||
| o_ar
|
| o_ar
|
||||||
| o_nocorr
|
| o_nocorr
|
||||||
|
| o_contemporaneous_correlation
|
||||||
| o_nofunctions
|
| o_nofunctions
|
||||||
| o_nomoments
|
| o_nomoments
|
||||||
| o_nograph
|
| o_nograph
|
||||||
|
@ -1672,6 +1673,7 @@ estimation_options : o_datafile
|
||||||
| o_forecast
|
| o_forecast
|
||||||
| o_smoother
|
| o_smoother
|
||||||
| o_moments_varendo
|
| o_moments_varendo
|
||||||
|
| o_contemporaneous_correlation
|
||||||
| o_filtered_vars
|
| o_filtered_vars
|
||||||
| o_kalman_algo
|
| o_kalman_algo
|
||||||
| o_kalman_tol
|
| o_kalman_tol
|
||||||
|
@ -2706,6 +2708,7 @@ o_tex : TEX { driver.option_num("TeX", "1"); };
|
||||||
o_forecast : FORECAST EQUAL INT_NUMBER { driver.option_num("forecast", $3); };
|
o_forecast : FORECAST EQUAL INT_NUMBER { driver.option_num("forecast", $3); };
|
||||||
o_smoother : SMOOTHER { driver.option_num("smoother", "1"); };
|
o_smoother : SMOOTHER { driver.option_num("smoother", "1"); };
|
||||||
o_moments_varendo : MOMENTS_VARENDO { driver.option_num("moments_varendo", "1"); };
|
o_moments_varendo : MOMENTS_VARENDO { driver.option_num("moments_varendo", "1"); };
|
||||||
|
o_contemporaneous_correlation : CONTEMPORANEOUS_CORRELATION { driver.option_num("contemporaneous_correlation", "1"); };
|
||||||
o_filtered_vars : FILTERED_VARS { driver.option_num("filtered_vars", "1"); };
|
o_filtered_vars : FILTERED_VARS { driver.option_num("filtered_vars", "1"); };
|
||||||
o_relative_irf : RELATIVE_IRF { driver.option_num("relative_irf", "1"); };
|
o_relative_irf : RELATIVE_IRF { driver.option_num("relative_irf", "1"); };
|
||||||
o_kalman_algo : KALMAN_ALGO EQUAL INT_NUMBER { driver.option_num("kalman_algo", $3); };
|
o_kalman_algo : KALMAN_ALGO EQUAL INT_NUMBER { driver.option_num("kalman_algo", $3); };
|
||||||
|
|
|
@ -298,6 +298,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
|
||||||
<DYNARE_STATEMENT>dsge_var {return token::DSGE_VAR;}
|
<DYNARE_STATEMENT>dsge_var {return token::DSGE_VAR;}
|
||||||
<DYNARE_STATEMENT>dsge_varlag {return token::DSGE_VARLAG;}
|
<DYNARE_STATEMENT>dsge_varlag {return token::DSGE_VARLAG;}
|
||||||
<DYNARE_STATEMENT>moments_varendo {return token::MOMENTS_VARENDO;}
|
<DYNARE_STATEMENT>moments_varendo {return token::MOMENTS_VARENDO;}
|
||||||
|
<DYNARE_STATEMENT>contemporaneous_correlation {return token::CONTEMPORANEOUS_CORRELATION;}
|
||||||
<DYNARE_STATEMENT>posterior_max_subsample_draws {return token::POSTERIOR_MAX_SUBSAMPLE_DRAWS;}
|
<DYNARE_STATEMENT>posterior_max_subsample_draws {return token::POSTERIOR_MAX_SUBSAMPLE_DRAWS;}
|
||||||
<DYNARE_STATEMENT>filtered_vars {return token::FILTERED_VARS;}
|
<DYNARE_STATEMENT>filtered_vars {return token::FILTERED_VARS;}
|
||||||
<DYNARE_STATEMENT>filter_step_ahead {return token::FILTER_STEP_AHEAD;}
|
<DYNARE_STATEMENT>filter_step_ahead {return token::FILTER_STEP_AHEAD;}
|
||||||
|
|
|
@ -123,7 +123,7 @@ end;
|
||||||
|
|
||||||
steady;
|
steady;
|
||||||
|
|
||||||
stoch_simul(order=1,irf=20,graph_format=eps);
|
stoch_simul(order=1,irf=20,graph_format=eps,contemporaneous_correlation);
|
||||||
|
|
||||||
write_latex_original_model;
|
write_latex_original_model;
|
||||||
write_latex_static_model;
|
write_latex_static_model;
|
||||||
|
@ -143,7 +143,7 @@ stderr gy_obs, 1;
|
||||||
corr gp_obs, gy_obs,0;
|
corr gp_obs, gy_obs,0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
estimation(order=1,datafile='../fs2000/fsdat_simul',mode_check,smoother,filter_decomposition,forecast = 8,filtered_vars,filter_step_ahead=[1,3],irf=20) m P c e W R k d y gy_obs;
|
estimation(order=1,datafile='../fs2000/fsdat_simul',mode_check,smoother,filter_decomposition,forecast = 8,filtered_vars,filter_step_ahead=[1,3],irf=20,contemporaneous_correlation) m P c e W R k d y gy_obs;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ stderr gp_obs, inv_gamma_pdf, 0.001, inf;
|
||||||
//corr gp_obs, gy_obs,normal_pdf, 0, 0.2;
|
//corr gp_obs, gy_obs,normal_pdf, 0, 0.2;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
estimation(mode_compute=9,order=1,datafile='../fs2000/fsdat_simul',mode_check,smoother,filter_decomposition,mh_replic=2002, mh_nblocks=2, mh_jscale=0.8,forecast = 8,bayesian_irf,filtered_vars,filter_step_ahead=[1,3],irf=20,moments_varendo) m P c e W R k d y;
|
estimation(mode_compute=9,order=1,datafile='../fs2000/fsdat_simul',mode_check,smoother,filter_decomposition,mh_replic=2002, mh_nblocks=2, mh_jscale=0.8,forecast = 8,bayesian_irf,filtered_vars,filter_step_ahead=[1,3],irf=20,moments_varendo,contemporaneous_correlation) m P c e W R k d y;
|
||||||
shock_decomposition y W R;
|
shock_decomposition y W R;
|
||||||
|
|
||||||
collect_LaTeX_Files(M_);
|
collect_LaTeX_Files(M_);
|
||||||
|
|
Loading…
Reference in New Issue