When you calculated the contribution from the likelihood for the data where the maximum didn’t change, you need to use
x_dist.logcdf(o_n_minus_1)rather thanx_dist.logp(o_n).
Sorry, I meant to say:
When you calculated the contribution from the likelihood for the data where the maximum didn’t change, you need to use
x_dist.logcdf(o_n_minus_1)rather thanx_dist.logcdf(o_n).
And thanks for pointing that out, yes you are correct. In my head I was thinking that it doesn’t make sense to evaluate the likelihood on the same value that is already being plugged into the definition of the likelihood, but in the case o_n = o_{n+1} this doesn’t matter. It shouldn’t matter which you use, and I guess you don’t even need to keep track of the _right_before arrays at all. You can just give the DensityDist flat_data itself rather than flat_data_right_before.