Closed Koohoko closed 2 months ago
Attention: Patch coverage is 55.55556%
with 4 lines
in your changes missing coverage. Please review.
Project coverage is 99.92%. Comparing base (
0332b11
) to head (bef1b1e
). Report is 2 commits behind head on master.
Hi Haogao, thanks for this collection of improvements. I have merged them and will add unit tests shortly.
Hi Developers,
Recently I have been using iubf for optimising parameters in a spatPomp model. I find some codes in the
iubf
function did not behave as expected with some particular input. Here I propose changes in a few lines in theR/iubf.R
to fix potential bugs.log_cond_densities[neighbor_u, ]
on this line will cause "out of bounds" error whenNrep_per_param = 1
. So I added a check for this, otherwise we may consider forcingNrep_per_param
to be greater than 1.The
def_resample
on this line can result in a NULL vector (vector of length 0), if allparam_resamp_log_weights
are the same. This can happen e.g. for $t_0$, when all observations are at the initial condition and adjusting parameters does have effect on the dmeasure results. Adef_resample
of length 0 will cause error when sampling it on this line. To fix this, I added a check testing the length ofdef_resample
.Still for the same code chunk as mention in the previous point, there is a special case need to be addressed when
length(def_resample) = 1
. Thesample
function will behave differently if the input is an integer of length 1, comparing to when usually we expect the inputdef_resample
is a vector of length > 1. For example whendef_resample
equals to an index3
, we want resampling $3$, rather than resampling ${1, 2, 3}$, for multiple times. To fix this, I added a special case forlength(def_resample) = 1
here.Please review if this can be helpful. Thank you so much again for this package.
Best, Haogao