Commit f8b8ec6c authored by Marco Ratto's avatar Marco Ratto
Browse files

fixes around init2shocks in plotting utilities

parent 5485597a
......@@ -51,6 +51,16 @@ if ~isempty(opts_decomp.type)
fig_mode = [fig_mode '_'];
end
if isfield(opts_decomp,'init2shocks') && opts_decomp.realtime==0
init2shocks_decomp = 1 ;
else
init2shocks_decomp = 0;
end
if init2shocks_decomp
fig_mode1 = [fig_mode1 '_init2shocks_decomp'];
fig_mode = [fig_mode 'init2shocks_decomp_'];
end
if isfield(opts_decomp,'init_cond_decomp')
init_cond_decomp = opts_decomp.init_cond_decomp ;
else
......
......@@ -24,7 +24,7 @@ function []=graph_decomp_detail(z,shock_names,endo_names,i_var,initial_date,Dyna
% 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.
%xf
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
......@@ -55,6 +55,16 @@ if ~isempty(opts_decomp.type)
fig_mode = [fig_mode '_'];
end
if isfield(opts_decomp,'init2shocks') && opts_decomp.realtime==0
init2shocks_decomp = 1 ;
else
init2shocks_decomp = 0;
end
if init2shocks_decomp
fig_mode1 = [fig_mode1 '_init2shocks_decomp'];
fig_mode = [fig_mode 'init2shocks_decomp_'];
end
if isfield(opts_decomp,'init_cond_decomp')
init_cond_decomp = opts_decomp.init_cond_decomp ;
else
......
......@@ -50,7 +50,7 @@ if size(varlist,1) == 0
end
end
if isfield(options_.plot_shock_decomp,'init2shocks') % private trap for uimenu calls
if isfield(options_.plot_shock_decomp,'init2shocks') && options_.plot_shock_decomp.realtime==0 % private trap for uimenu calls
init2shocks=options_.plot_shock_decomp.init2shocks;
else
init2shocks=[];
......@@ -59,7 +59,7 @@ if ~isempty(init2shocks)
init2shocks=M_.init2shocks.(init2shocks);
end
orig_endo_names = M_.endo_names;
epilogue_decomp=false;
if exist_varlist && any(ismember(varlist,M_.epilogue_names))
epilogue_decomp=true;
......@@ -252,15 +252,15 @@ if ~isempty(init2shocks) && ~expand
n=size(init2shocks,1);
M_.exo_names_init=M_.exo_names;
for i=1:n
j=strmatch(init2shocks{i}{1},M_.endo_names,'exact');
j=strmatch(init2shocks{i}{1},orig_endo_names,'exact');
if ~isempty(init2shocks{i}{2})
jj=strmatch(init2shocks{i}{2},M_.exo_names,'exact');
M_.exo_names_init{jj}=[M_.exo_names_init{jj} ' + ' M_.endo_names{j}];
z(:,jj,:)= z(:,jj,:) + oo_.initval_decomposition (:,j,:);
M_.exo_names_init{jj}=[M_.exo_names_init{jj} ' + ' orig_endo_names{j}];
z(:,jj,:)= z(:,jj,:) + oo_.initval_decomposition (:,j,1:size(z,3));
else
z(:,end,:)= z(:,end,:) - oo_.initval_decomposition (:,j,:);
z(:,end,:)= z(:,end,:) - oo_.initval_decomposition (:,j,1:size(z,3));
end
z(:,end-1,:)= z(:,end-1,:) - oo_.initval_decomposition (:,j,:);
z(:,end-1,:)= z(:,end-1,:) - oo_.initval_decomposition (:,j,1:size(z,3));
end
end
......@@ -271,6 +271,9 @@ if ~epilogue_decomp
else
steady_state = oo_.steady_state;
end
if isfield(oo_.shock_decomposition_info,'i_var') && (M_.endo_nbr<length(orig_endo_names))
steady_state=steady_state(oo_.shock_decomposition_info.i_var);
end
else
steady_state = oo_.shock_decomposition_info.epilogue_steady_state;
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment