Non-linear modelling - Michaelis-Menten

I’m not entirely sure, but my guess is that some of the functions used in calculating the Poisson log probability mass function (lpmf) do weird things if lambda is zero. Note that in most applications, lambda will be declared with a lower-bound constraint of zero, and so it will never actually reach a literal zero during sampling.

Stan doesn’t “understand” that lambda[i] is a constant when tips[i] is zero; it still takes a gradient of the lpmf with respect to lambda. My guess is that even though the gradient of the Poisson lpmf for an observed zero with respect to lambda is finite at lambda = 0, the implementation that Stan uses isn’t designed to handle the case where lambda literally reaches zero.

I don’t really know C++ and so I can’t take the time now to really understand the code, but my best guess is that the multiply_log function here goes haywire or is discontinuous when given zero as an argument.

Edit:
Here’s the c++ for multiply_log, which suggests that the above explanation is probably the correct one:

2 Likes