From 64a2a4388a35318a642ae766c952b94f8feebd31 Mon Sep 17 00:00:00 2001
From: Willi Mutschler <willi@mutschler.eu>
Date: Wed, 1 Apr 2020 14:46:22 +0200
Subject: [PATCH] :bug: :book: Fixes TaRB with student t proposal distribution

---
 doc/manual/source/the-model-file.rst           | 7 +++++++
 matlab/posterior_sampler_iteration.m           | 2 +-
 tests/estimation/t_proposal/fs2000_student.mod | 4 ++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/manual/source/the-model-file.rst b/doc/manual/source/the-model-file.rst
index 67d64ccd21..07101fdb66 100644
--- a/doc/manual/source/the-model-file.rst
+++ b/doc/manual/source/the-model-file.rst
@@ -5430,6 +5430,8 @@ block decomposition of the model (see :opt:`block`).
 
                Available options are:
 
+           .. _prop_distrib:
+
            ``'proposal_distribution'``
 
                Specifies the statistical distribution used for the
@@ -5528,6 +5530,11 @@ block decomposition of the model (see :opt:`block`).
 
            ``'tailored_random_block_metropolis_hastings'``
 
+           ``'proposal_distribution'``
+
+               Specifies the statistical distribution used for the
+               proposal density. See :ref:`proposal_distribution <prop_distrib>`.
+
            ``new_block_probability = DOUBLE``
 
                Specifies the probability of the next parameter
diff --git a/matlab/posterior_sampler_iteration.m b/matlab/posterior_sampler_iteration.m
index a1f155b54d..e524748228 100644
--- a/matlab/posterior_sampler_iteration.m
+++ b/matlab/posterior_sampler_iteration.m
@@ -118,7 +118,7 @@ switch posterior_sampling_method
         if strcmpi(sampler_options.proposal_distribution,'rand_multivariate_normal')
             n = nxopt;
         elseif strcmpi(sampler_options.proposal_distribution,'rand_multivariate_student')
-            n = options_.student_degrees_of_freedom;
+            n = sampler_options.student_degrees_of_freedom;
         end
 
         proposed_par = feval(sampler_options.proposal_distribution, xopt_current_block', proposal_covariance_Cholesky_decomposition_upper, n);
diff --git a/tests/estimation/t_proposal/fs2000_student.mod b/tests/estimation/t_proposal/fs2000_student.mod
index aa52caf286..a7483741b4 100644
--- a/tests/estimation/t_proposal/fs2000_student.mod
+++ b/tests/estimation/t_proposal/fs2000_student.mod
@@ -116,3 +116,7 @@ varobs gp_obs gy_obs;
 
 estimation(order=1, datafile='../fsdat_simul',nobs=192, loglinear, mh_replic=2002, mh_nblocks=2, mh_jscale=0.8,mode_compute=4,
 posterior_sampler_options=('proposal_distribution','rand_multivariate_student','student_degrees_of_freedom',5,'save_tmp_file',0));
+
+estimation(order=1, datafile='../fsdat_simul',nobs=192, loglinear, mh_replic=30, mh_nblocks=1, mh_jscale=0.8,mode_compute=4,
+posterior_sampling_method='tailored_random_block_metropolis_hastings',
+posterior_sampler_options=('proposal_distribution','rand_multivariate_student','student_degrees_of_freedom',5,'save_tmp_file',0));
-- 
GitLab