And, the better performance of the model after making this change (very consistent and larger likelihood and less variability in pulse count)
I'm fairly confident that the only change needed is to correct the second parameter to Rf_rgamma(), by taking the current value's inverse -- 1 / (priors->err_beta + 0.5 * ssq). I didn't re-derive it on my own (so open to being wrong), but the effect on performance appeared confirmatory...
I reviewed the precision derivations in Ken & Karen's dissertations and the following --
I'm fairly confident that the only change needed is to correct the second parameter to
Rf_rgamma()
, by taking the current value's inverse --1 / (priors->err_beta + 0.5 * ssq)
. I didn't re-derive it on my own (so open to being wrong), but the effect on performance appeared confirmatory...I'll push a commit and reference it here shortly.