Merge branch 'dynare-globals'

Ref. !2167
kalman-mex
Sébastien Villemot 2023-09-11 16:43:36 +02:00
commit a0ea6005e8
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
7 changed files with 14 additions and 207 deletions

View File

@ -1,54 +0,0 @@
function dcompare(s1)
% Copyright © 2001-2017 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
global options_ nvx nvy x y lag1
ftest(s1,0) ;
i = [lag1(1):size(x,2)-lag1(2)+1]' ;
if size(options_.smpl,1) == 1
error(['DSAMPLE not specified.']) ;
end
if options_.smpl(3) > 0
if options_.smpl(3) == 2
if options_.smpl(1)<0 || options_.smpl(2)>size(x,2)-lag1(2)
error ('Wrong sample.') ;
end
i = [options_.smpl(1)+lag1(1):options_.smpl(2)+lag1(1)]' ;
elseif options_.smpl(3) == 1
if options_.smpl(1)>size(x,2)-lag1(2)
error ('Wrong sample.') ;
end
i = [lag1(1):options_.smpl(1)+lag1(1)]' ;
end
end
j = bseastr(nvx,nvy) ;
if stop
return ;
end
z = mean(mean(abs(x(j,i)-y(j,i)))) ;
disp (['The mean absolute difference between set ' s1(1,:) 'and set ' s1(2,:)]) ;
disp (['is : ' num2str(z)]) ;
return ;

View File

@ -1,8 +1,10 @@
function disp_dr(dr,order,var_list)
function disp_dr(M_,options_,dr,order,var_list)
%disp_dr(M_,options_,dr,order,var_list)
% Display the decision rules
%
% INPUTS
% - M [structure] storing the model information
% - options [structure] storing the options
% - dr [struct] decision rules.
% - order [integer] order of approximation.
% - var_list [cell] list of endogenous variables for which the decision rules should be printed.
@ -27,8 +29,6 @@ function disp_dr(dr,order,var_list)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
global M_ options_
if order~=1 && M_.hessian_eq_zero
order = 1;
warning('disp_dr: using order = 1 because Hessian is equal to zero');

View File

@ -1,10 +1,13 @@
function z = display_static_residuals(options_resid_)
% function z = display_static_residuals(options_resid_)
function z = display_static_residuals(M_, options_, oo_,options_resid_)
% function z = display_static_residuals(M_, options_, oo_,options_resid_)
%
% Computes static residuals associated with the guess values.
%
% INPUTS
% options_resid_: options to resid
% M: [structure] storing the model information
% options: [structure] storing the options
% oo: [structure] storing the results
% options_resid_: options to resid
%
% OUTPUTS
% z: residuals
@ -29,11 +32,7 @@ function z = display_static_residuals(options_resid_)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
global M_ options_ oo_
% Properly handle the case where no input argument is given, e.g. when
% writing “z = resid;” in a .mod file (hence not using the preprocessor syntax).
non_zero = nargin > 0 && isfield(options_resid_, 'non_zero') && options_resid_.non_zero;
non_zero = (isfield(options_resid_, 'non_zero') && options_resid_.non_zero);
tags = M_.equations_tags;
istag = 0;
@ -41,15 +40,6 @@ if ~isempty(tags)
istag = 1;
end
steady_state_old = oo_.steady_state;
% Keep of a copy of M_.Sigma_e
Sigma_e = M_.Sigma_e;
% Set M_.Sigma_e=0 (we evaluate the *deterministic* static model)
M_.Sigma_e = zeros(size(Sigma_e));
info = 0;
if any(imag(oo_.steady_state))
imagrow=find(imag(oo_.steady_state));
if ~isempty(imagrow)
@ -83,8 +73,6 @@ else
disp_string='';
end
end
M_.Sigma_e = Sigma_e;
% Display the non-zero residuals if no return value
if nargout == 0
@ -128,6 +116,4 @@ if nargout == 0
disp('All residuals are zero')
end
skipline(2)
end
oo_.steady_state = steady_state_old;
end

View File

@ -1,56 +0,0 @@
function dsample(s1,s2)
% function dsample(s1,s2)
% This optional command permits to reduce the number of periods considered in following output commands.
% If only one argument is provided, output is from period 1 to the period specified in the DSAMPLE command.
% If two arguments are present output is done for the interval between the two periods.
% DSAMPLE without arguments reset the sample to the one specified by PERIODS
%
% INPUTS
% s1: first period
% s2: last period
%
% OUTPUTS
% none
%
% SPECIAL REQUIREMENTS
% none
% Copyright © 2001-2017 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
global options_
options_.smpl = zeros(2,1) ;
if nargin == 0
options_.smpl(1) = 1 ;
options_.smpl(2) = options_.periods ;
elseif nargin == 1
if s1 > options_.periods
error('DSAMPLE: argument greater than number of periods');
end
options_.smpl(1) = 1 ;
options_.smpl(2) = s1 ;
else
if s1 > options_.periods || s2 > options_.periods
error('DSAMPLE: one of the arguments is greater than number of periods');
end
options_.smpl(1) = s1 ;
options_.smpl(2) = s2 ;
end
% 02/23/01 MJ added error checking

View File

@ -1,69 +0,0 @@
function mcompare(s1,s2)
% MCOMPARE : MCOMPARE ( [ 'file1' ; 'file2' ] , [ 'var1' ; 'var2' ...] )
% This optional command plots the relative differences between
% two different simulations for a list of variables. One plot
% is drawn for each variable. The trajectories must have been
% previously saved by the instruction DYNASAVE. The simulation
% in file1 serves as the base simulation and the ploted quantity
% is equal to the difference between the two simulation reported
% to the first one. If, for a given variable, zero is one of the
% value of the base simulation, the absolute difference is ploted
% instead of the relative one.
% Copyright © 2001-2017 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
global options_
global nvx nvy x y lag1
ftest(s1,s2) ;
ix = [1-lag1(1):size(x,2)-lag1(1)]' ;
i = [lag1(1):size(ix,1)-lag1(2)+1]' ;
if size(options_.smpl,1) == 1
error(['DSAMPLE not specified.']) ;
end
if options_.smpl(3) > 0
if options_.smpl(3) == 2
if options_.smpl(1)<0 || options_.smpl(2)>size(x,2)-lag1(2)
error ('Wrong sample.') ;
end
i = [options_.smpl(1)+lag1(1):options_.smpl(2)+lag1(1)]' ;
elseif options_.smpl(3) == 1
if options_.smpl(1)>size(x,2)-lag1(2)
error ('Wrong sample.') ;
end
i = [lag1(1):options_.smpl(1)+lag1(1)]' ;
end
end
for k = 1:size(x,1)
figure ;
x1 = x(k,i) ;
y1 = y(k,i) ;
if nnz(x1) < length(x1)
plot(ix(i),(y1-x1)) ;
else
plot(ix(i),(y1-x1)./x1) ;
end
xlabel(['Periods']) ;
title(['Variable ' s2(k)]) ;
end
return ;

View File

@ -188,7 +188,7 @@ if ~options_.noprint
skipline()
if options_.order <= 2 && ~PI_PCL_solver
if ~options_.nofunctions
disp_dr(oo_.dr,options_.order,var_list);
disp_dr(M_,options_,oo_.dr,options_.order,var_list);
end
end
end

@ -1 +1 @@
Subproject commit 140c91e91188ee701d4a185d1ad771c23999f491
Subproject commit ea3476179591eed472a14a35570660bd643cca1e