From 2a1889b508eaeacf77eec7ff556f5bffe0b84342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Karaba=29?= Date: Thu, 4 Mar 2010 16:15:27 +0100 Subject: [PATCH] Set penalty equal to minus infinity in mcmc (so that the probability of discarding vectors of deep parameters such that the steady state does not exist, does not satisfy BK conditions,... is one). --- matlab/independent_metropolis_hastings_core.m | 2 ++ matlab/random_walk_metropolis_hastings_core.m | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/matlab/independent_metropolis_hastings_core.m b/matlab/independent_metropolis_hastings_core.m index ca7cbad5e..22bd89e4e 100644 --- a/matlab/independent_metropolis_hastings_core.m +++ b/matlab/independent_metropolis_hastings_core.m @@ -26,6 +26,8 @@ global bayestopt_ estim_params_ options_ M_ oo_ struct2local(myinputs); +% (re)Set the penalty +bayestopt_.penalty = -Inf; MhDirectoryName = CheckPath('metropolis'); diff --git a/matlab/random_walk_metropolis_hastings_core.m b/matlab/random_walk_metropolis_hastings_core.m index c35a07c9e..419ff3a7b 100644 --- a/matlab/random_walk_metropolis_hastings_core.m +++ b/matlab/random_walk_metropolis_hastings_core.m @@ -26,6 +26,8 @@ global bayestopt_ estim_params_ options_ M_ oo_ struct2local(myinputs); +% (re)Set the penalty +bayestopt_.penalty = -Inf; MhDirectoryName = CheckPath('metropolis'); @@ -90,7 +92,7 @@ for b = fblck:nblck, else logpost = -inf; end - if (logpost > -inf) & (log(rand) < logpost-ilogpo2(b)) + if (logpost > -inf) && (log(rand) < logpost-ilogpo2(b)) x2(irun,:) = par; ix2(b,:) = par; logpo2(irun) = logpost;