Venturecxx
Venturecxx copied to clipboard
Implement logDensityOfData in SuffPoissonOutputPSP correctly.
The current implementation computes the logDensity of the sufficient statistic itself xsum
, rather than an observation sequence (x1,\dots,xN)
with sufficient statistic xsum
. The two differ by a constant (not a function of mu
). My reasoning at the time was that we cannot compute the density of the sequence itself since the expression also has some product factorials etc.
The solution is easy, just store sum_log_fact_x
in the spaux
as well, which can be done in a numerically stable way by adding gammaln(x+1)
to this statistic when incorporate
is called ... not sure why I did not consider doing this before.