diff --git a/doc/dynare.texi b/doc/dynare.texi
index b6f649014c91b64ce5aa669835c9ef2dd279257d..5fd0cc9cf1a2ebd15c527db275376b926c5b9319 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -7271,13 +7271,18 @@ decompositions, @i{i.e.} @math{Y(t|T)}, for @math{t=[T@dots{}T+k]}. @xref{vintag
 
 @descriptionhead
 
-This command plots the historical shock decomposition already computed by command 
-@code{shock_decomposition}. 
-The @code{variable_names} provided govern for which 
-variables the decomposition is plotted.
+This command plots the historical shock decomposition already computed by
+@code{shock_decomposition}. The @code{variable_names} provided govern which
+variables the decomposition is plotted for.
 
 Note that this command must come after @code{shock_decomposition} or @code{realtime_shock_decomposition}.
 
+Further note that, unlike the majority of dynare commands, the options
+specified below are overwritten with their defaults before every call to
+@code{plot_shock_decomposition}. Hence, if you want to reuse an option in a
+subsequent call to @code{plot_shock_decomposition}, you must pass it to the
+command again.
+
 @optionshead
 
 @table @code
@@ -7295,11 +7300,14 @@ Note that this command must come after @code{shock_decomposition} or @code{realt
 @itemx graph_format = ( @var{FORMAT}, @var{FORMAT}@dots{} )
 @xref{graph_format}.
 
-@item detail_plot
-@anchor{detail_plot} Plots shock contributions using subplots, one per shock (or group of shocks).
+@item detail_plot = @var{INT_NUMBER}
+Plots shock contributions using subplots, one per shock (or group of
+shocks). Pass @math{1} to turn it on and @math{0} to turn it off. Default:
+@math{0}
 
-@item interactive 
-@anchor{interactive} Under MATLAB, add uimenu's for detailed group plots.
+@item interactive = @var{INT_NUMBER}
+Under MATLAB, add uimenu's for detailed group plots. Pass @math{1} to turn it
+on and @math{0} to turn it off. Default: @math{0}
 
 @item screen_shocks
 @anchor{screen_shcoks} For large models (@i{i.e.} for models with more than @math{16}
diff --git a/matlab/WriteShockDecomp2Excel.m b/matlab/WriteShockDecomp2Excel.m
index 538d21aa09e7192c11397878bf6015e92b1f20b6..dff5c79bbb7baaf2a94facf758ed287b924234ad 100644
--- a/matlab/WriteShockDecomp2Excel.m
+++ b/matlab/WriteShockDecomp2Excel.m
@@ -33,7 +33,7 @@ fig_mode='';
 fig_mode1='';
 fig_name='';
 screen_shocks=0;
-use_shock_groups = DynareOptions.use_shock_groups;
+use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
 if use_shock_groups
     shock_groups = DynareModel.shock_groups.(use_shock_groups);
     shock_ind = fieldnames(shock_groups);
diff --git a/matlab/annualized_shock_decomposition.m b/matlab/annualized_shock_decomposition.m
index 8552b9d4f51a057db4cd5c374edc5b451a0d72a7..30cd81241abc10fd4747d6ea49fed049bde9cdc4 100644
--- a/matlab/annualized_shock_decomposition.m
+++ b/matlab/annualized_shock_decomposition.m
@@ -49,7 +49,7 @@ function [z, endo_names, endo_names_tex, steady_state, i_var, oo_] = annualized_
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
-opts = options_.shock_decomp;
+opts = options_.plot_shock_decomp;
 nvar = length(i_var);
 GYTREND0 = q2a.GYTREND0;
 var_type = q2a.type;
@@ -61,8 +61,8 @@ cumfix      = q2a.cumfix;
 if isstruct(oo_)
 %     z = oo_.shock_decomposition;
         myopts=options_;
-        myopts.shock_decomp.type='qoq';
-        myopts.shock_decomp.realtime=0;
+        myopts.plot_shock_decomp.type='qoq';
+        myopts.plot_shock_decomp.realtime=0;
         [z, junk] = plot_shock_decomposition(M_,oo_,myopts,[]);
 else
     z = oo_;
@@ -93,8 +93,8 @@ end
 if isstruct(aux)
     if ischar(aux.y)
         myopts=options_;
-        myopts.shock_decomp.type='qoq';
-        myopts.shock_decomp.realtime=0;
+        myopts.plot_shock_decomp.type='qoq';
+        myopts.plot_shock_decomp.realtime=0;
         [y_aux, steady_state_aux] = plot_shock_decomposition(M_,oo_,myopts,aux.y);
         aux.y=y_aux;
         aux.yss=steady_state_aux;
@@ -183,9 +183,9 @@ for i=t0:4:t1,
     za=[];
     gza=[];
         myopts=options_;
-        myopts.shock_decomp.type='qoq';
-        myopts.shock_decomp.realtime=1;
-        myopts.shock_decomp.vintage=i;
+        myopts.plot_shock_decomp.type='qoq';
+        myopts.plot_shock_decomp.realtime=1;
+        myopts.plot_shock_decomp.vintage=i;
         [z, steady_state_aux] = plot_shock_decomposition(M_,oo_,myopts,[]);
         z = z(i_var,:,:);
 if isstruct(aux)
diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m
index 2f44a0524503f6e2d3119a151791d5596dd49614..1df3ea3a06b862f9bd56e0dd1e57cc95791085c1 100644
--- a/matlab/global_initialization.m
+++ b/matlab/global_initialization.m
@@ -723,23 +723,13 @@ options_.discretionary_tol = 1e-7;
 options_.parameter_set = [];
 options_.use_shock_groups = '';
 options_.colormap = '';
-options_.shock_decomp.detail_plot=0;
-options_.shock_decomp.fig_name='';
 options_.shock_decomp.init_state = 0;
-options_.shock_decomp.interactive = 0;
-options_.shock_decomp.plot_end_date=[];
-options_.shock_decomp.plot_init_date=[];
-options_.shock_decomp.screen_shocks=0;
-options_.shock_decomp.steadystate=0;
-options_.shock_decomp.type = '';
-options_.shock_decomp.write_xls=0;
-% Shock decomposition realtime
-options_.shock_decomp.realtime=0; % 0 is standard; 1 is realtime (pool/vintage); 2 is conditional (pool/vintage); 3 is forecast (pool/vintage)
-options_.shock_decomp.vintage=0; % 0 pool realtime/conditional; int: forecast/conditional shock decompositions
-options_.shock_decomp.forecast=0;
-options_.shock_decomp.presample=NaN;
-options_.shock_decomp.save_realtime=0; % saves memory
 
+% Shock decomposition realtime
+options_.shock_decomp.forecast = 0;
+options_.shock_decomp.presample = NaN;
+options_.shock_decomp.save_realtime = 0; % saves memory
+options_ = set_default_plot_shock_decomposition_options(options_);
 
 % Nonlinearfilters
 options_.nonlinear_filter = [];
diff --git a/matlab/graph_decomp.m b/matlab/graph_decomp.m
index 7a3f9e415c7631328d8693e30639638d26831d50..b26078dc444c6b26b196c1a70d1aec3232cd5f3b 100644
--- a/matlab/graph_decomp.m
+++ b/matlab/graph_decomp.m
@@ -29,7 +29,7 @@ function []=graph_decomp(z,shock_names,endo_names,i_var,initial_date,DynareModel
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
 GraphDirectoryName = CheckPath('graphs',DynareModel.dname);
-new_colormap = DynareOptions.colormap;
+new_colormap = DynareOptions.plot_shock_decomp.colormap;
 
 % number of components equals number of shocks + 1 (initial conditions)
 comp_nbr = size(z,2)-1;
@@ -39,7 +39,7 @@ fig_mode='';
 fig_mode1='';
 % fig_name='';
 % screen_shocks=0;
-opts_decomp = DynareOptions.shock_decomp;
+opts_decomp = DynareOptions.plot_shock_decomp;
 if isfield(opts_decomp,'steady_state')
     SteadyState = opts_decomp.steady_state;
 end
@@ -50,7 +50,7 @@ if ~isempty(opts_decomp.type)
 end
 fig_name_long = opts_decomp.fig_name;
 
-use_shock_groups = DynareOptions.use_shock_groups;
+use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
 screen_shocks = opts_decomp.screen_shocks;
 if use_shock_groups | comp_nbr<=18,
     screen_shocks=0;
@@ -87,7 +87,7 @@ end
 nvar = length(i_var);
 
 %% write LaTeX-Header
-if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
+if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
     fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_name '.tex'],'w');
     fprintf(fidTeX,'%% TeX eps-loader file generated by Dynare''s graph_decomp.m.\n');
     fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
@@ -128,7 +128,7 @@ for j=1:nvar
     if ymax-ymin < 1e-6
         continue
     end
-    fhandle = dyn_figure(DynareOptions.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) '.'], 'PaperPositionMode', 'auto','PaperOrientation','landscape','renderermode','auto');
+    fhandle = dyn_figure(DynareOptions.plot_shock_decomp.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) '.'], 'PaperPositionMode', 'auto','PaperOrientation','landscape','renderermode','auto');
     set(fhandle,'position' ,[50 50 1500 750])
     ax=axes('Position',[0.1 0.1 0.6 0.8],'box','on');
 %     plot(ax,x(2:end),z1(end,:),'k-','LineWidth',2)
@@ -190,10 +190,10 @@ for j=1:nvar
         ht = text(0.3,y1+0.3*height,labels(i,:),'Interpreter','none');
         hold on
         if interactive & (~isoctave & use_shock_groups)
-            mydata.fig_name = DynareOptions.shock_decomp.fig_name(2:end);
-            mydata.use_shock_groups = DynareOptions.use_shock_groups;
+            mydata.fig_name = DynareOptions.plot_shock_decomp.fig_name(2:end);
+            mydata.use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
             mydata.shock_group = shock_groups.(shock_ind{i});
-            mydata.shock_decomp = DynareOptions.shock_decomp;
+            mydata.shock_decomp = DynareOptions.plot_shock_decomp;
             if ~isempty(mydata.shock_group.shocks{1})
                 c = uicontextmenu;
                 hl.UIContextMenu=c;
@@ -213,8 +213,8 @@ for j=1:nvar
         colormap(new_colormap)
     end
     hold off
-    dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name],DynareOptions.nodisplay,DynareOptions.graph_format);
-    if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
+    dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
+    if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
         fprintf(fidTeX,'\\begin{figure}[H]\n');
         fprintf(fidTeX,'\\centering \n');
         fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_name]);
@@ -226,7 +226,7 @@ for j=1:nvar
 end
 
 %% write LaTeX-Footer
-if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
+if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
     fprintf(fidTeX,' \n');
     fprintf(fidTeX,'%% End of TeX file.\n');
     fclose(fidTeX);
diff --git a/matlab/graph_decomp_detail.m b/matlab/graph_decomp_detail.m
index 42088950396cb3ffa727675ad70073796425b426..c78fe6d4005229a4e0cb3dbd2365d998568c6764 100644
--- a/matlab/graph_decomp_detail.m
+++ b/matlab/graph_decomp_detail.m
@@ -34,7 +34,7 @@ fig_mode='';
 fig_mode1='';
 % fig_name='';
 % screen_shocks=0;
-use_shock_groups = DynareOptions.use_shock_groups;
+use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
 if use_shock_groups
     shock_groups = DynareModel.shock_groups.(use_shock_groups);
     shock_ind = fieldnames(shock_groups);
@@ -43,7 +43,7 @@ end
 % number of components equals number of shocks + 1 (initial conditions)
 comp_nbr = size(z,2)-1;
 
-opts_decomp = DynareOptions.shock_decomp;
+opts_decomp = DynareOptions.plot_shock_decomp;
 
 interactive = opts_decomp.interactive;
 if ~isempty(opts_decomp.type)
@@ -52,7 +52,7 @@ if ~isempty(opts_decomp.type)
     fig_mode = [fig_mode '_'];
 end
 screen_shocks = opts_decomp.screen_shocks;
-if DynareOptions.use_shock_groups | comp_nbr<=18,
+if DynareOptions.plot_shock_decomp.use_shock_groups | comp_nbr<=18,
     screen_shocks=0;
 end
 fig_name_long = opts_decomp.fig_name;
@@ -105,7 +105,7 @@ end
 nvar = length(i_var);
 
 %% write LaTeX-Header
-if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
+if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
     fidTeX = fopen([GraphDirectoryName, filesep, DynareModel.fname '_shock_decomp' fig_mode1 fig_name '_detail.tex'],'w');
     fprintf(fidTeX,'%% TeX eps-loader file generated by Dynare''s graph_decomp_detail.m.\n');
     fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
@@ -151,7 +151,7 @@ for j=1:nvar
         continue
     end
     for jf = 1:nfigs
-    fhandle = dyn_figure(DynareOptions.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) ' (detail).'],'position',[200 100 650 850], 'PaperPositionMode', 'auto','PaperOrientation','portrait','renderermode','auto');
+    fhandle = dyn_figure(DynareOptions.plot_shock_decomp.nodisplay,'Name',[preamble_txt fig_name_long strrep(fig_mode1, '_', ' ') ': ' deblank(endo_names(i_var(j),:)) ' (detail).'],'position',[200 100 650 850], 'PaperPositionMode', 'auto','PaperOrientation','portrait','renderermode','auto');
     a0=zeros(1,4);
     a0(3)=inf;
     a0(4)=-inf;
@@ -179,10 +179,10 @@ for j=1:nvar
         set(gca,'ylim',a0(3:4))
         hold on, h1=plot(x(2:end),z1(end,:),'k-','LineWidth',2);
         if interactive & (~isoctave & use_shock_groups)
-            mydata.fig_name = DynareOptions.shock_decomp.fig_name(2:end);
-            mydata.use_shock_groups = DynareOptions.use_shock_groups;
+            mydata.fig_name = DynareOptions.plot_shock_decomp.fig_name(2:end);
+            mydata.use_shock_groups = DynareOptions.plot_shock_decomp.use_shock_groups;
             mydata.shock_group = shock_groups.(shock_ind{ic});
-            mydata.shock_decomp = DynareOptions.shock_decomp;
+            mydata.shock_decomp = DynareOptions.plot_shock_decomp;
             if ~isempty(mydata.shock_group.shocks{1})
                 c = uicontextmenu;
                 hax.UIContextMenu=c;
@@ -224,8 +224,8 @@ for j=1:nvar
     else
         suffix = ['_detail'];
     end
-    dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name suffix],DynareOptions.nodisplay,DynareOptions.graph_format);
-    if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
+    dyn_saveas(fhandle,[GraphDirectoryName, filesep, DynareModel.fname,'_shock_decomposition_',deblank(endo_names(i_var(j),:)),fig_mode1,fig_name suffix],DynareOptions.plot_shock_decomp.nodisplay,DynareOptions.plot_shock_decomp.graph_format);
+    if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
         fprintf(fidTeX,'\\begin{figure}[H]\n');
         fprintf(fidTeX,'\\centering \n');
         fprintf(fidTeX,'\\includegraphics[width=0.8\\textwidth]{%s/graphs/%s_shock_decomposition_%s}\n',DynareModel.fname,DynareModel.fname,[deblank(endo_names(i_var(j),:)) fig_mode1 fig_name suffix]);
@@ -238,7 +238,7 @@ for j=1:nvar
 end
 
 %% write LaTeX-Footer
-if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
+if DynareOptions.TeX && any(strcmp('eps',cellstr(DynareOptions.plot_shock_decomp.graph_format)))
     fprintf(fidTeX,' \n');
     fprintf(fidTeX,'%% End of TeX file.\n');
     fclose(fidTeX);
diff --git a/matlab/plot_shock_decomposition.m b/matlab/plot_shock_decomposition.m
index 9ff2bb67682a6bcf0b05fa6b039dc76691aa3a35..368e233a7a5469231910c7cd970ccada8ef78478 100644
--- a/matlab/plot_shock_decomposition.m
+++ b/matlab/plot_shock_decomposition.m
@@ -28,6 +28,11 @@ function [z, steady_state] = plot_shock_decomposition(M_,oo_,options_,varlist)
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
+options_.nodisplay = options_.plot_shock_decomp.nodisplay;
+options_.graph_format = options_.plot_shock_decomp.graph_format;
+options_.use_shock_groups = options_.plot_shock_decomp.use_shock_groups;
+options_.colormap = options_.plot_shock_decomp.colormap;
+
 % indices of endogenous variables
 if size(varlist,1) == 0
     varlist = M_.endo_names(1:M_.orig_endo_nbr,:);
@@ -49,27 +54,27 @@ fig_name='';
 % steadystate=0;
 % write_xls=0;
 
-if isfield(options_.shock_decomp,'expand'), % private trap for uimenu calls
-    expand=options_.shock_decomp.expand;
+if isfield(options_.plot_shock_decomp,'expand'), % private trap for uimenu calls
+    expand=options_.plot_shock_decomp.expand;
 else
     expand=0;
 end
 
-if ~isempty(options_.shock_decomp.fig_name)
-    fig_name=[' ' options_.shock_decomp.fig_name];
+if ~isempty(options_.plot_shock_decomp.fig_name)
+    fig_name=[' ' options_.plot_shock_decomp.fig_name];
 end
-type=options_.shock_decomp.type;
-detail_plot=options_.shock_decomp.detail_plot;
-realtime_= options_.shock_decomp.realtime;
-vintage_ = options_.shock_decomp.vintage;
+type=options_.plot_shock_decomp.type;
+detail_plot=options_.plot_shock_decomp.detail_plot;
+realtime_= options_.plot_shock_decomp.realtime;
+vintage_ = options_.plot_shock_decomp.vintage;
 forecast_ = options_.shock_decomp.forecast;
-steadystate = options_.shock_decomp.steadystate;
-write_xls = options_.shock_decomp.write_xls;
+steadystate = options_.plot_shock_decomp.steadystate;
+write_xls = options_.plot_shock_decomp.write_xls;
 
 initial_date = options_.initial_date;
  
-if isfield(options_.shock_decomp,'q2a'), % private trap for aoa calls
-    q2a=options_.shock_decomp.q2a;
+if isfield(options_.plot_shock_decomp,'q2a'), % private trap for aoa calls
+    q2a=options_.plot_shock_decomp.q2a;
     if isstruct(q2a) && isempty(fieldnames(q2a)),
         q2a=0;
     end
@@ -129,7 +134,7 @@ if isequal(type,'aoa') && isstruct(q2a) && realtime_
                 initial_date1=initial_date0+1;
             end
         end
-        t0=min(options_.shock_decomp.save_realtime);
+        t0=min(options_.plot_shock_decomp.save_realtime);
         ini1 = initial_date+t0-1;
         t0=t0+(4-ini1.time(2));
     if ~isfield(q2a,'var_type'), % private trap for aoa calls
@@ -153,7 +158,7 @@ if isequal(type,'aoa') && isstruct(q2a) && realtime_
     
 %     if isstruct(q2a.aux) && ischar(q2a.aux.y)
 %         opts=options_;
-%         opts.shock_decomp.type='qoq';
+%         opts.plot_shock_decomp.type='qoq';
 %         [y_aux, steady_state_aux] = plot_shock_decomposition(M_,oo_,opts,q2a.aux.y);
 %         q2a.aux.y=y_aux;
 %         q2a.aux.yss=steady_state_aux;
@@ -173,11 +178,11 @@ if ~expand
     fig_name = fig_name1;
 end
 gend = size(z,3);
-if options_.use_shock_groups
-    shock_groups = M_.shock_groups.(options_.use_shock_groups);
+if options_.plot_shock_decomp.use_shock_groups
+    shock_groups = M_.shock_groups.(options_.plot_shock_decomp.use_shock_groups);
     shock_ind = fieldnames(shock_groups);
     ngroups = length(shock_ind);
-    fig_name=[fig_name ' group ' options_.use_shock_groups];
+    fig_name=[fig_name ' group ' options_.plot_shock_decomp.use_shock_groups];
     shock_names = shock_ind;
     for i=1:ngroups,
        shock_names{i} = (shock_groups.(shock_ind{i}).label);
@@ -195,7 +200,7 @@ if options_.use_shock_groups
     zothers = sum(z(:,1:nshocks,:),2);
     shock_groups.(['group' int2str(ngroups+1)]).label =  'Others';
     shock_groups.(['group' int2str(ngroups+1)]).shocks =  cellstr(M_.exo_names(find(~ismember([1:M_.exo_nbr],kcum)),:))';
-    M_.shock_groups.(options_.use_shock_groups)=shock_groups;
+    M_.shock_groups.(options_.plot_shock_decomp.use_shock_groups)=shock_groups;
     if any(any(zothers)),
         shock_names = [shock_names; {'Others + Initial Values'}];
     end        
@@ -212,8 +217,8 @@ end
         MAP(end,:) = [0.7 0.7 0.7];
 %         MAP = [MAP; [0.7 0.7 0.7]; [0.3 0.3 0.3]];
 
-if isempty(options_.colormap),
-    options_.colormap = MAP;
+if isempty(options_.plot_shock_decomp.colormap),
+    options_.plot_shock_decomp.colormap = MAP;
 end
 
 switch type
@@ -269,7 +274,7 @@ switch type
             
             if isstruct(q2a.aux) && ischar(q2a.aux.y)
                 opts=options_;
-                opts.shock_decomp.type='qoq';
+                opts.plot_shock_decomp.type='qoq';
                 [y_aux, steady_state_aux] = plot_shock_decomposition(M_,oo_,opts,q2a.aux.y);
                 q2a.aux.y=y_aux;
                 q2a.aux.yss=steady_state_aux;
@@ -292,11 +297,11 @@ switch type
             z=z(:,:,t0:4:end);
         end
         
-        if ~isempty(options_.shock_decomp.plot_init_date)
-            options_.shock_decomp.plot_init_date = dates([int2str(options_.shock_decomp.plot_init_date.time(1)) 'Y']);
+        if ~isempty(options_.plot_shock_decomp.plot_init_date)
+            options_.plot_shock_decomp.plot_init_date = dates([int2str(options_.plot_shock_decomp.plot_init_date.time(1)) 'Y']);
         end
-        if ~isempty(options_.shock_decomp.plot_end_date)
-            options_.shock_decomp.plot_end_date = dates([int2str(options_.shock_decomp.plot_end_date.time(1)) 'Y']);
+        if ~isempty(options_.plot_shock_decomp.plot_end_date)
+            options_.plot_shock_decomp.plot_end_date = dates([int2str(options_.plot_shock_decomp.plot_end_date.time(1)) 'Y']);
         end
         
         
@@ -306,7 +311,7 @@ switch type
 
 end
 if steadystate
-    options_.shock_decomp.steady_state=steady_state;
+    options_.plot_shock_decomp.steady_state=steady_state;
 end
 
 if nargout
@@ -319,17 +324,17 @@ end
 my_initial_date = initial_date;
 a = 1;
 b = size(z,3);
-if ~isempty(options_.shock_decomp.plot_init_date)
-    my_initial_date = max(initial_date,options_.shock_decomp.plot_init_date);
-    a = find((initial_date:initial_date+b-1)==options_.shock_decomp.plot_init_date);
+if ~isempty(options_.plot_shock_decomp.plot_init_date)
+    my_initial_date = max(initial_date,options_.plot_shock_decomp.plot_init_date);
+    a = find((initial_date:initial_date+b-1)==options_.plot_shock_decomp.plot_init_date);
 end
-if ~isempty(options_.shock_decomp.plot_end_date)
-    b = find((initial_date:initial_date+b-1)==options_.shock_decomp.plot_end_date);
+if ~isempty(options_.plot_shock_decomp.plot_end_date)
+    b = find((initial_date:initial_date+b-1)==options_.plot_shock_decomp.plot_end_date);
 end
 z = z(:,:,a:b);
 % end crop data
 
-options_.shock_decomp.fig_name=fig_name;
+options_.plot_shock_decomp.fig_name=fig_name;
 if detail_plot,
     graph_decomp_detail(z,shock_names,M_.endo_names,i_var,my_initial_date,M_,options_)
 else
@@ -337,5 +342,5 @@ else
 end
 
 if write_xls
-    WriteShockDecomp2Excel(z,shock_names,M_.endo_names,i_var,initial_date,M_,options_,options_.shock_decomp);
-end
\ No newline at end of file
+    WriteShockDecomp2Excel(z,shock_names,M_.endo_names,i_var,initial_date,M_,options_,options_.plot_shock_decomp);
+end
diff --git a/matlab/set_default_plot_shock_decomposition_options.m b/matlab/set_default_plot_shock_decomposition_options.m
new file mode 100644
index 0000000000000000000000000000000000000000..327c047cb9f04c6b94b3dc2f06201e7fc83d21f2
--- /dev/null
+++ b/matlab/set_default_plot_shock_decomposition_options.m
@@ -0,0 +1,51 @@
+function options = set_default_plot_shock_decomposition_options(options)
+%function options = set_default_plot_shock_decomposition_options(options)
+% sets the default options for prior_shock_decomposition
+%
+% INPUTS
+%    options
+%
+% OUTPUTS
+%    options
+%
+% SPECIAL REQUIREMENTS
+%    none
+
+% Copyright (C) 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 <http://www.gnu.org/licenses/>.
+
+options.plot_shock_decomp.use_shock_groups = '';
+options.plot_shock_decomp.colormap = '';
+options.plot_shock_decomp.nodisplay = 0;
+options.plot_shock_decomp.graph_format = 'eps';
+options.plot_shock_decomp.detail_plot = 0;
+options.plot_shock_decomp.interactive = 0;
+options.plot_shock_decomp.screen_shocks = 0;
+options.plot_shock_decomp.steadystate = 0;
+options.plot_shock_decomp.type = '';
+options.plot_shock_decomp.fig_name = '';
+options.plot_shock_decomp.write_xls = 0;
+options.plot_shock_decomp.realtime = 0; % 0 is standard; 1 is realtime
+                                        % (pool/vintage); 2 is conditional
+                                        % (pool/vintage); 3 is forecast
+                                        % (pool/vintage)
+options.plot_shock_decomp.vintage = 0; % 0 pool realtime/conditional; int:
+                                       % forecast/conditional shock
+                                       % decompositions
+options.plot_shock_decomp.plot_init_date = [];
+options.plot_shock_decomp.plot_end_date = [];
+end
diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc
index cfc3b59b5f1f45538c9b5153b3f8e2c94b6f03d0..d91d04c106359bbb8c2d8607541b9dac4ad44c99 100644
--- a/preprocessor/ComputingTasks.cc
+++ b/preprocessor/ComputingTasks.cc
@@ -1680,6 +1680,21 @@ RealtimeShockDecompositionStatement::writeOutput(ostream &output, const string &
   output << "oo_ = realtime_shock_decomposition(M_,oo_,options_,var_list_,bayestopt_,estim_params_);" << endl;
 }
 
+PlotShockDecompositionStatement::PlotShockDecompositionStatement(const SymbolList &symbol_list_arg,
+                                                                 const OptionsList &options_list_arg) :
+  symbol_list(symbol_list_arg),
+  options_list(options_list_arg)
+{
+}
+
+void
+PlotShockDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
+{
+  output << "options_ = set_default_plot_shock_decomposition_options(options_);" << endl;
+  options_list.writeOutput(output);
+  symbol_list.writeOutput("var_list_", output);
+  output << "plot_shock_decomposition(M_, oo_, options_, var_list_);" << endl;
+}
 
 ConditionalForecastStatement::ConditionalForecastStatement(const OptionsList &options_list_arg) :
   options_list(options_list_arg)
diff --git a/preprocessor/ComputingTasks.hh b/preprocessor/ComputingTasks.hh
index e74211f783623f6d93016eca755e5dba423be48a..41da6098233034ea532cbfc16f7406fc2a4003d9 100644
--- a/preprocessor/ComputingTasks.hh
+++ b/preprocessor/ComputingTasks.hh
@@ -593,9 +593,21 @@ private:
   const OptionsList options_list;
 public:
   RealtimeShockDecompositionStatement(const SymbolList &symbol_list_arg,
-                              const OptionsList &options_list_arg);
+                                      const OptionsList &options_list_arg);
+  virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
+};
+
+class PlotShockDecompositionStatement : public Statement
+{
+private:
+  const SymbolList symbol_list;
+  const OptionsList options_list;
+public:
+  PlotShockDecompositionStatement(const SymbolList &symbol_list_arg,
+                                  const OptionsList &options_list_arg);
   virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
 };
+
 class ConditionalForecastStatement : public Statement
 {
 private:
diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy
index 246c8ddacd85d9ba78736efce9df3c7ebde493ed..8c2b910663da2a516d31567aef775b7d600a1d32 100644
--- a/preprocessor/DynareBison.yy
+++ b/preprocessor/DynareBison.yy
@@ -86,10 +86,10 @@ class ParsingDriver;
 
 %token AIM_SOLVER ANALYTIC_DERIVATION ANALYTIC_DERIVATION_MODE AR AUTOCORR POSTERIOR_SAMPLING_METHOD
 %token BAYESIAN_IRF BETA_PDF BLOCK USE_CALIBRATION SILENT_OPTIMIZER
-%token BVAR_DENSITY BVAR_FORECAST NODECOMPOSITION DR_DISPLAY_TOL HUGE_NUMBER
-%token BVAR_PRIOR_DECAY BVAR_PRIOR_FLAT BVAR_PRIOR_LAMBDA
-%token BVAR_PRIOR_MU BVAR_PRIOR_OMEGA BVAR_PRIOR_TAU BVAR_PRIOR_TRAIN
-%token BVAR_REPLIC BYTECODE ALL_VALUES_REQUIRED PROPOSAL_DISTRIBUTION
+%token BVAR_DENSITY BVAR_FORECAST NODECOMPOSITION DR_DISPLAY_TOL HUGE_NUMBER FIG_NAME WRITE_XLS
+%token BVAR_PRIOR_DECAY BVAR_PRIOR_FLAT BVAR_PRIOR_LAMBDA INTERACTIVE SCREEN_SHOCKS STEADYSTATE
+%token BVAR_PRIOR_MU BVAR_PRIOR_OMEGA BVAR_PRIOR_TAU BVAR_PRIOR_TRAIN DETAIL_PLOT TYPE
+%token BVAR_REPLIC BYTECODE ALL_VALUES_REQUIRED PROPOSAL_DISTRIBUTION REALTIME VINTAGE
 %token CALIB_SMOOTHER CHANGE_TYPE CHECK CONDITIONAL_FORECAST CONDITIONAL_FORECAST_PATHS CONF_SIG CONSTANT CONTROLLED_VAREXO CORR COVAR CUTOFF CYCLE_REDUCTION LOGARITHMIC_REDUCTION
 %token CONSIDER_ALL_ENDOGENOUS CONSIDER_ONLY_OBSERVED
 %token DATAFILE FILE SERIES DOUBLING DR_CYCLE_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_MAXITER DR_ALGO DROP DSAMPLE DYNASAVE DYNATYPE CALIBRATION DIFFERENTIATE_FORWARD_VARS
@@ -129,9 +129,9 @@ class ParsingDriver;
 %token TEX RAMSEY_MODEL RAMSEY_POLICY RAMSEY_CONSTRAINTS PLANNER_DISCOUNT DISCRETIONARY_POLICY DISCRETIONARY_TOL
 %token <string_val> TEX_NAME
 %token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR GSA_SAMPLE_FILE USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED
-%token VALUES VAR VAREXO VAREXO_DET VAROBS PREDETERMINED_VARIABLES
+%token VALUES VAR VAREXO VAREXO_DET VAROBS PREDETERMINED_VARIABLES PLOT_SHOCK_DECOMPOSITION
 %token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL WRITE_LATEX_ORIGINAL_MODEL
-%token XLS_SHEET XLS_RANGE LMMCP OCCBIN BANDPASS_FILTER COLORMAP
+%token XLS_SHEET XLS_RANGE LMMCP OCCBIN BANDPASS_FILTER COLORMAP QOQ YOY AOA
 %left COMMA
 %left EQUAL_EQUAL EXCLAMATION_EQUAL
 %left LESS GREATER LESS_EQUAL GREATER_EQUAL
@@ -262,6 +262,7 @@ statement : parameters
           | write_latex_original_model
           | shock_decomposition
           | realtime_shock_decomposition
+          | plot_shock_decomposition
           | conditional_forecast
           | conditional_forecast_paths
           | plot_conditional_forecast
@@ -2139,6 +2140,16 @@ realtime_shock_decomposition : REALTIME_SHOCK_DECOMPOSITION ';'
                                { driver.realtime_shock_decomposition(); }
                              ;
 
+plot_shock_decomposition : PLOT_SHOCK_DECOMPOSITION ';'
+                           {driver.plot_shock_decomposition(); }
+                         | PLOT_SHOCK_DECOMPOSITION '(' plot_shock_decomposition_options_list ')' ';'
+                           { driver.plot_shock_decomposition(); }
+                         | PLOT_SHOCK_DECOMPOSITION symbol_list ';'
+                           { driver.plot_shock_decomposition(); }
+                         | PLOT_SHOCK_DECOMPOSITION '(' plot_shock_decomposition_options_list ')' symbol_list ';'
+                           { driver.plot_shock_decomposition(); }
+                         ;
+
 bvar_prior_option : o_bvar_prior_tau
                   | o_bvar_prior_decay
                   | o_bvar_prior_lambda
@@ -2524,6 +2535,25 @@ realtime_shock_decomposition_option : o_parameter_set
                                     | o_save_realtime
                                     ;
 
+plot_shock_decomposition_options_list : plot_shock_decomposition_option COMMA plot_shock_decomposition_options_list
+                                      | plot_shock_decomposition_option
+                                      ;
+
+plot_shock_decomposition_option : o_psd_use_shock_groups
+                                | o_psd_colormap
+                                | o_psd_nodisplay
+                                | o_psd_graph_format
+                                | o_psd_detail_plot
+                                | o_psd_interactive
+                                | o_psd_screen_shocks
+                                | o_psd_steadystate
+                                | o_psd_type
+                                | o_psd_fig_name
+                                | o_psd_write_xls
+                                | o_psd_realtime
+                                | o_psd_vintage
+                                ;
+
 homotopy_setup: HOMOTOPY_SETUP ';' homotopy_list END ';'
                { driver.end_homotopy();};
 
@@ -2865,11 +2895,17 @@ o_shock_decomposition_presample : PRESAMPLE EQUAL INT_NUMBER { driver.option_num
 o_shock_decomposition_forecast : FORECAST EQUAL INT_NUMBER { driver.option_num("shock_decomp.forecast", $3); };
 o_save_realtime : SAVE_REALTIME EQUAL vec_int { driver.option_vec_int("shock_decomp.save_realtime", $3); };
 o_nodisplay : NODISPLAY { driver.option_num("nodisplay","1"); };
+o_psd_nodisplay : NODISPLAY { driver.option_num("plot_shock_decomp.nodisplay","1"); };
 o_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats
                  { driver.process_graph_format_option(); }
                | GRAPH_FORMAT EQUAL '(' list_allowed_graph_formats ')'
                  { driver.process_graph_format_option(); }
                ;
+o_psd_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats
+                     { driver.plot_shock_decomp_process_graph_format_option(); }
+                   | GRAPH_FORMAT EQUAL '(' list_allowed_graph_formats ')'
+                     { driver.plot_shock_decomp_process_graph_format_option(); }
+                   ;
 allowed_graph_formats : EPS
                         { driver.add_graph_format("eps"); }
                       | FIG
@@ -2975,7 +3011,21 @@ o_dr : DR EQUAL CYCLE_REDUCTION {driver.option_num("dr_cycle_reduction", "1"); }
 o_dr_cycle_reduction_tol : DR_CYCLE_REDUCTION_TOL EQUAL non_negative_number {driver.option_num("dr_cycle_reduction_tol",$3);};
 o_dr_logarithmic_reduction_tol : DR_LOGARITHMIC_REDUCTION_TOL EQUAL non_negative_number {driver.option_num("dr_logarithmic_reduction_tol",$3);};
 o_dr_logarithmic_reduction_maxiter : DR_LOGARITHMIC_REDUCTION_MAXITER EQUAL INT_NUMBER {driver.option_num("dr_logarithmic_reduction_maxiter",$3);};
-
+o_psd_detail_plot : DETAIL_PLOT { driver.option_num("plot_shock_decomp.detail_plot", "1"); };
+o_psd_interactive : INTERACTIVE { driver.option_num("plot_shock_decomp.interactive", "1"); };
+o_psd_screen_shocks : SCREEN_SHOCKS { driver.option_num("plot_shock_decomp.screen_shocks", "1"); };
+o_psd_steadystate : STEADYSTATE EQUAL INT_NUMBER { driver.option_num("plot_shock_decomp.steadystate", $3); };
+o_psd_fig_name : FIG_NAME EQUAL filename { driver.option_str("plot_shock_decomp.fig_name", $3); };
+o_psd_type : TYPE EQUAL QOQ
+             { driver.option_str("plot_shock_decomp.type", "qoq"); }
+           | TYPE EQUAL YOY
+             { driver.option_str("plot_shock_decomp.type", "qoq"); }
+           | TYPE EQUAL AOA
+             { driver.option_str("plot_shock_decomp.type", "qoq"); }
+           ;
+o_psd_write_xls : WRITE_XLS { driver.option_num("plot_shock_decomp.write_xls", "1"); };
+o_psd_realtime : REALTIME EQUAL INT_NUMBER { driver.option_num("plot_shock_decomp.realtime", $3); };
+o_psd_vintage : VINTAGE EQUAL INT_NUMBER { driver.option_num("plot_shock_decomp.vintage", $3); };
 o_bvar_prior_tau : BVAR_PRIOR_TAU EQUAL signed_number { driver.option_num("bvar_prior_tau", $3); };
 o_bvar_prior_decay : BVAR_PRIOR_DECAY EQUAL non_negative_number { driver.option_num("bvar_prior_decay", $3); };
 o_bvar_prior_lambda : BVAR_PRIOR_LAMBDA EQUAL signed_number { driver.option_num("bvar_prior_lambda", $3); };
@@ -3285,7 +3335,11 @@ o_sampling_draws : SAMPLING_DRAWS EQUAL INT_NUMBER { driver.option_num("sampling
 o_use_shock_groups : USE_SHOCK_GROUPS { driver.option_str("use_shock_groups","default"); }
                    | USE_SHOCK_GROUPS EQUAL symbol { driver.option_str("use_shock_groups", $3); }
                    ;
+o_psd_use_shock_groups : USE_SHOCK_GROUPS { driver.option_str("plot_shock_decomp.use_shock_groups","default"); }
+                       | USE_SHOCK_GROUPS EQUAL symbol { driver.option_str("plot_shock_decomp.use_shock_groups", $3); }
+                       ;
 o_colormap : COLORMAP EQUAL symbol { driver.option_num("colormap",$3); };
+o_psd_colormap : COLORMAP EQUAL symbol { driver.option_num("plot_shock_decomp.colormap",$3); };
 
 range : symbol ':' symbol
         {
diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll
index c8d1accdd21fcffeaa77091126909740bba9ac97..59eac989a97f541b55cd1564bae18410f18b9408 100644
--- a/preprocessor/DynareFlex.ll
+++ b/preprocessor/DynareFlex.ll
@@ -151,6 +151,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
 <INITIAL>forecast {BEGIN DYNARE_STATEMENT; return token::FORECAST;}
 <INITIAL>shock_decomposition {BEGIN DYNARE_STATEMENT; return token::SHOCK_DECOMPOSITION;}
 <INITIAL>realtime_shock_decomposition {BEGIN DYNARE_STATEMENT; return token::REALTIME_SHOCK_DECOMPOSITION;}
+<INITIAL>plot_shock_decomposition {BEGIN DYNARE_STATEMENT; return token::PLOT_SHOCK_DECOMPOSITION;}
 <INITIAL>sbvar {BEGIN DYNARE_STATEMENT; return token::SBVAR;}
 <INITIAL>ms_estimation {BEGIN DYNARE_STATEMENT; return token::MS_ESTIMATION;}
 <INITIAL>ms_simulation {BEGIN DYNARE_STATEMENT; return token::MS_SIMULATION;}
@@ -573,6 +574,18 @@ 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>parameter_set {return token::PARAMETER_SET; }
 <DYNARE_STATEMENT>init_state {return token::INIT_STATE; }
 <DYNARE_STATEMENT>save_realtime {return token::SAVE_REALTIME;}
+<DYNARE_STATEMENT>detail_plot {return token::DETAIL_PLOT;}
+<DYNARE_STATEMENT>interactive {return token::INTERACTIVE;}
+<DYNARE_STATEMENT>screen_shocks {return token::SCREEN_SHOCKS;}
+<DYNARE_STATEMENT>steadystate {return token::STEADYSTATE;}
+<DYNARE_STATEMENT>type {return token::TYPE;}
+<DYNARE_STATEMENT>qoq {return token::QOQ; }
+<DYNARE_STATEMENT>yoy {return token::YOY; }
+<DYNARE_STATEMENT>aoa {return token::AOA; }
+<DYNARE_STATEMENT>fig_name {return token::FIG_NAME;}
+<DYNARE_STATEMENT>write_xls {return token::WRITE_XLS;}
+<DYNARE_STATEMENT>realtime {return token::REALTIME;}
+<DYNARE_STATEMENT>vintage {return token::VINTAGE;}
 <DYNARE_STATEMENT>prior_mode {return token::PRIOR_MODE; }
 <DYNARE_STATEMENT>prior_mean {return token::PRIOR_MEAN; }
 <DYNARE_STATEMENT>posterior_mode {return token::POSTERIOR_MODE; }
diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc
index dc7953ce98c56a0d79efb891909b3a2a15546c3a..e0df6128623d2c9cce493bdc4471fbae3309116a 100644
--- a/preprocessor/ParsingDriver.cc
+++ b/preprocessor/ParsingDriver.cc
@@ -2133,6 +2133,14 @@ ParsingDriver::realtime_shock_decomposition()
   options_list.clear();
 }
 
+void
+ParsingDriver::plot_shock_decomposition()
+{
+  mod_file->addStatement(new PlotShockDecompositionStatement(symbol_list, options_list));
+  symbol_list.clear();
+  options_list.clear();
+}
+
 void
 ParsingDriver::conditional_forecast()
 {
@@ -2815,6 +2823,13 @@ ParsingDriver::process_graph_format_option()
   graph_formats.clear();
 }
 
+void
+ParsingDriver::plot_shock_decomp_process_graph_format_option()
+{
+  options_list.symbol_list_options["plot_shock_decomp.graph_format"] = graph_formats;
+  graph_formats.clear();
+}
+
 void
 ParsingDriver::model_diagnostics()
 {
diff --git a/preprocessor/ParsingDriver.hh b/preprocessor/ParsingDriver.hh
index 28385563cea923a2ecb9a9f356683eec1da3b36e..29b9c3210293f5e9ce5930f192e4a91455858395 100644
--- a/preprocessor/ParsingDriver.hh
+++ b/preprocessor/ParsingDriver.hh
@@ -592,6 +592,8 @@ public:
   void shock_decomposition();
   //! Realtime Shock decomposition
   void realtime_shock_decomposition();
+  //! Plot Shock decomposition
+  void plot_shock_decomposition();
   //! Conditional forecast statement
   void conditional_forecast();
   //! Conditional forecast paths block
@@ -722,6 +724,8 @@ public:
   void add_graph_format(const string &name);
   //! Add the graph_format option to the OptionsList structure
   void process_graph_format_option();
+  //! Add the graph_format option to the plot_shock_decomp substructure of the OptionsList structure
+  void plot_shock_decomp_process_graph_format_option();
   //! Model diagnostics
   void model_diagnostics();
   //! Processing the parallel_local_files option
diff --git a/tests/shock_decomposition/ls2003_plot.mod b/tests/shock_decomposition/ls2003_plot.mod
index d3c4c3c855c9c5ee93045c70c6825dd4d1ee0ea0..7faa00d0c7cf0eacffce430361ff11be6033bda1 100644
--- a/tests/shock_decomposition/ls2003_plot.mod
+++ b/tests/shock_decomposition/ls2003_plot.mod
@@ -81,13 +81,11 @@ shock_decomposition(use_shock_groups=trade) y_obs R_obs pie_obs dq de;
 
 // various tests for plot_shock_decompositions
 // standard plot [using trade group defined before]
-plot_shock_decomposition(M_,oo_,options_,var_list_);
+plot_shock_decomposition;
 
 // test datailed, custom name and yoy plots
-options_.shock_decomp.detail_plot = 1;
-options_.shock_decomp.fig_names = 'MR';
-options_.shock_decomp.type='yoy';
-plot_shock_decomposition(M_,oo_,options_,var_list_);
+plot_shock_decomposition(detail_plot, fig_name = MR, type = yoy);
+
 
 close all,
 
@@ -96,80 +94,42 @@ close all,
 // first compute realtime decompositions [pre-processor not yet available]
 realtime_shock_decomposition(forecast=8, save_realtime=[5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77]);
 
-options_.shock_decomp.detail_plot = 0;
-options_.shock_decomp.type='';
-options_.use_shock_groups='';
-options_.shock_decomp.fig_names = '';
-
-
 //realtime pooled
-options_.shock_decomp.realtime=1; 
-options_.shock_decomp.vintage=0; 
-plot_shock_decomposition(M_,oo_,options_,var_list_);
+plot_shock_decomposition(realtime = 1);
 
 //conditional pooled
-options_.shock_decomp.realtime=2; 
-plot_shock_decomposition(M_,oo_,options_,var_list_);
-options_.shock_decomp.realtime=2; 
+plot_shock_decomposition(realtime = 2);
+
 // conditional 8-step ahead decomposition, given 1989q4
-options_.shock_decomp.detail_plot = 1;
-options_.shock_decomp.vintage=29; 
-plot_shock_decomposition(M_,oo_,options_,var_list_);
+plot_shock_decomposition(detail_plot, realtime = 2, vintage = 29);
 
 close all,
 
 //forecast pooled
-options_.shock_decomp.detail_plot = 0;
-options_.shock_decomp.realtime=3; 
-options_.shock_decomp.vintage=0; 
-plot_shock_decomposition(M_,oo_,options_,var_list_);
+plot_shock_decomposition(realtime = 3);
 
 // forecast 8-step ahead decomposition, given 1989q4
-options_.shock_decomp.detail_plot = 1;
-options_.shock_decomp.realtime=3; 
-options_.shock_decomp.vintage=29; 
-plot_shock_decomposition(M_,oo_,options_,var_list_);
+plot_shock_decomposition(detail_plot, realtime = 3, vintage = 29);
 
 close all,
 
 // now I test annualized variables
-options_.shock_decomp.realtime=0; 
-options_.shock_decomp.detail_plot = 1;
-options_.shock_decomp.interactive=0;
-options_.use_shock_groups='';
-options_.shock_decomp.type='aoa'; 
-options_.shock_decomp.q2a=1; 
-options_.shock_decomp.islog=1; 
-plot_shock_decomposition(M_,oo_,options_,'y');
-
-options_.shock_decomp.realtime=1; 
-options_.shock_decomp.vintage=0; 
-plot_shock_decomposition(M_,oo_,options_,'y');
-
-options_.shock_decomp.vintage=29; 
-options_.shock_decomp.realtime=1; 
-plot_shock_decomposition(M_,oo_,options_,'y');
-options_.shock_decomp.realtime=2; 
-plot_shock_decomposition(M_,oo_,options_,'y');
-options_.shock_decomp.realtime=3; 
-plot_shock_decomposition(M_,oo_,options_,'y');
+options_.plot_shock_decomp.q2a=1;
+options_.plot_shock_decomp.islog=1;
+plot_shock_decomposition(detail_plot, type = aoa) y;
+
+plot_shock_decomposition(realtime = 1) y;
+plot_shock_decomposition(realtime = 1, vintage = 29) y;
+plot_shock_decomposition(realtime = 2, vintage = 29) y;
+plot_shock_decomposition(realtime = 3, vintage = 29) y;
 
 close all
 
 //test uimenu for groups
-options_.shock_decomp.realtime=0; 
-options_.shock_decomp.detail_plot = 1;
-options_.shock_decomp.interactive=1;
-options_.use_shock_groups='row';
-options_.shock_decomp.type='qoq'; 
-plot_shock_decomposition(M_,oo_,options_,var_list_);
-
-options_.shock_decomp.detail_plot = 1;
-options_.shock_decomp.realtime=3; 
-options_.shock_decomp.vintage=29; 
-plot_shock_decomposition(M_,oo_,options_,var_list_);
+plot_shock_decomposition(detail_plot, interactive, use_shock_groups = row, type = qoq);
+plot_shock_decomposition(detail_plot, interactive, realtime = 3, vintage = 29);
 
 collect_latex_files;
 if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
     error('TeX-File did not compile.')
-end 
+end