From 2dd6510051304f2c534ad4d10bdd0b7d88ebdfaf Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Fri, 17 Sep 2021 14:43:50 +0200
Subject: [PATCH] smoother2histval.m: undo logging

Closes https://git.dynare.org/Dynare/dynare/-/issues/1407
---
 matlab/smoother2histval.m                            | 6 +++++-
 tests/smoother2histval/fs2000_smooth_stoch_simul.mod | 5 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/matlab/smoother2histval.m b/matlab/smoother2histval.m
index c7502012e8..463931ab73 100644
--- a/matlab/smoother2histval.m
+++ b/matlab/smoother2histval.m
@@ -179,7 +179,11 @@ end
 % Handle all endogenous variables to be copied
 for i = 1:length(invars)
     if ~isempty(strmatch(invars{i}, M_.endo_names, 'exact')) 
-        s = smoothedvars.(invars{i});
+        if oo_.Smoother.loglinear
+            s = exp(smoothedvars.(invars{i}));
+        else
+            s = smoothedvars.(invars{i});
+        end
     elseif ~isempty(strmatch(invars{i}, M_.exo_names, 'exact'))
         s = smoothedshocks.(invars{i});
     else
diff --git a/tests/smoother2histval/fs2000_smooth_stoch_simul.mod b/tests/smoother2histval/fs2000_smooth_stoch_simul.mod
index 91bc25ef67..63a7bb3985 100644
--- a/tests/smoother2histval/fs2000_smooth_stoch_simul.mod
+++ b/tests/smoother2histval/fs2000_smooth_stoch_simul.mod
@@ -82,10 +82,11 @@ varobs gp_obs gy_obs;
 
 options_.solve_tolf = 1e-12;
 
-estimation(order=1,datafile=fsdat_simul,nobs=192,mh_replic=1500,mh_nblocks=1,mh_jscale=0.8,smoother,consider_all_endogenous);
-
+estimation(order=1,loglinear,datafile=fsdat_simul,nobs=192,mh_replic=2,mh_nblocks=1,mh_jscale=0.8,smoother,consider_all_endogenous_and_auxiliary);
+steady;
 smoother2histval(period = 5);
 
+options_.loglinear=0;
 stoch_simul(nomoments);
 
 forecast;
-- 
GitLab