From 2882827084ee59e0619de98f24706b8326657cea Mon Sep 17 00:00:00 2001 From: Michel Juillard Date: Mon, 28 Mar 2011 09:16:39 +0200 Subject: [PATCH] making sure variance of subsample is not very small before computing kernel density --- matlab/posterior_moments.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matlab/posterior_moments.m b/matlab/posterior_moments.m index 797222aa9..2f2e3cbf1 100644 --- a/matlab/posterior_moments.m +++ b/matlab/posterior_moments.m @@ -70,7 +70,7 @@ post_deciles = xx([round(0.1*number_of_draws) ... density = []; if info number_of_grid_points = 2^9; % 2^9 = 512 !... Must be a power of two. - if post_var > 0 + if post_var > 1e-12 bandwidth = 0; % Rule of thumb optimal bandwidth parameter. kernel_function = 'gaussian'; % Gaussian kernel for Fast Fourrier Transform approximaton. optimal_bandwidth = mh_optimal_bandwidth(xx,number_of_draws,bandwidth,kernel_function);