From ce700ddaa42891155f678b2869814b3743cc85c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stepan@adjemian.eu>
Date: Sun, 24 Oct 2021 19:29:31 +0200
Subject: [PATCH] Acknowldge time_shift option in print_expectations.

Lagged information set was missing in the evaluation routine.

(cherry picked from commit a5ccd0ae903a230f731e862fb98ded4e835da5e6)
---
 matlab/print_expectations.m | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/matlab/print_expectations.m b/matlab/print_expectations.m
index 099933132c..e5ea95a72c 100644
--- a/matlab/print_expectations.m
+++ b/matlab/print_expectations.m
@@ -251,6 +251,10 @@ if isequal(expectationmodel.auxiliary_model_type, 'trend_component')
     maxlag = maxlag+1;
 end
 
+if isequal(expectationmodelkind, 'var')
+    timeindices = (0:(maxlag-1))+abs(expectationmodel.time_shift);
+end
+
 if isequal(expectationmodelkind, 'var') && isequal(expectationmodel.auxiliary_model_type, 'var')
     id = id+1;
     expression = sprintf('%1.16f', M_.params(expectationmodel.param_indices(id)));
@@ -302,8 +306,8 @@ for i=1:maxlag
         end
         switch expectationmodelkind
           case 'var'
-            if i>1
-                variable = sprintf('dbase.%s(-%d)', variable, i-1);
+            if timeindices(i)>0
+                variable = sprintf('dbase.%s(-%d)', variable, timeindices(i));
             else
                 variable = sprintf('dbase.%s', variable);
             end
-- 
GitLab