Hi all nimble users!
Thank you for answering questions every day and maintaining nimble.
It is very helpful and I appreciate it very much.
This is a report that can make nimble more efficient tool.
In this nimbleSMC version, log_likelihood in ParticleFilter is calculated by
log_likelihood = log(1/M * sum(weight)). # M and weight mean the number of particles
# and the weight of each particles respectively
It is from p.6~7 in paper below.
But actually, it sometimes causes the underflow problem and I got poor-estimation problems because of this underflow.
So I suggest that nimble should use this calculation,
weight_log = log(weight) # weight means the weight for each particles
max_w = max(weight_log)
weight = exp(weight_log - max_w)
log_likelihood = log(1/M * sum(weight_log)) + max_w
This is the same meaning as the calculation that is used in nimble now.
You can modify these formulas and check easily.
I've attached the test code that show the problem.
This underflow problem can make ParticleFilter less effective because of the lower-weight particles. And in some cases, underflow may occur for most particles due to the larger absolute value of the log-likelihood in higher dimensional estimation.
This problem is discussed in the book below(sorry this is written in Japanese).
Thank you for reading and I'm glad if you think about this report.
Thanks,
Kei
Paper : Michaud N, De Valpine P, Turek D, Paciorek CJ, Nguyen D (2021). “Sequential Monte Carlo Methods in the nimble and nimbleSMC R Packages.” Journal of Statistical Software, 100(3), 1–39. doi:10.18637/jss.v100.i03.