From 9abac8ccdbad9d405f93bf28d6500d1de183c791 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Mon, 20 Mar 2017 09:37:53 +0100
Subject: [PATCH] Store indicator whether smoother was used with loglinear

Required to keep track of whether estimates were logged. Related to #1407
---
 doc/dynare.texi                     | 5 +++++
 matlab/prior_posterior_statistics.m | 5 +++++
 matlab/store_smoother_results.m     | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/doc/dynare.texi b/doc/dynare.texi
index 1dfff7e9d2..9267283c9e 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -6723,6 +6723,11 @@ Fields are of the form:
 @end example
 @end defvr
 
+@defvr {MATLAB/Octave variable} oo_.Smoother.loglinear
+Indicator keeping track of whether the smoother was run with the @ref{loglinear} option 
+and thus whether stored smoothed objects are in logs.
+@end defvr
+
 @defvr {MATLAB/Octave variable} oo_.PosteriorTheoreticalMoments
 @anchor{oo_.PosteriorTheoreticalMoments}
 Variable set by the @code{estimation} command, if it is used with the
diff --git a/matlab/prior_posterior_statistics.m b/matlab/prior_posterior_statistics.m
index 1aa8cd01a0..685e7c30c4 100644
--- a/matlab/prior_posterior_statistics.m
+++ b/matlab/prior_posterior_statistics.m
@@ -141,6 +141,11 @@ ifil = zeros(n_variables_to_fill,1);
 run_smoother = 0;
 if options_.smoother || options_.forecast || options_.filter_step_ahead || options_.smoothed_state_uncertainty
     run_smoother = 1;
+    if options_.loglinear
+        oo_.Smoother.loglinear=1;
+    else
+        oo_.Smoother.loglinear=0;
+    end
 end
 
 filter_covariance=0;
diff --git a/matlab/store_smoother_results.m b/matlab/store_smoother_results.m
index cd9293f409..d6e3de4cfa 100644
--- a/matlab/store_smoother_results.m
+++ b/matlab/store_smoother_results.m
@@ -76,6 +76,11 @@ if nargin<16
     Trend=zeros(options_.number_of_observed_variables,gend);
 end
 
+if options_.loglinear
+    oo_.Smoother.loglinear=1;
+else
+    oo_.Smoother.loglinear=0;
+end
 %% write variable steady state
 oo_.Smoother.SteadyState = ys;
 
-- 
GitLab