rbchan / unmarked

R package for hierarchical models in ecological research
https://rbchan.github.io/unmarked/
37 stars 25 forks source link

Refactor gmultmix likelihood function #240

Closed kenkellner closed 1 year ago

kenkellner commented 1 year ago

When counts are high the result can sometimes be infinite. I wonder if re-writing the function to be more like the gdistremoval one would prevent this.

Specifically this line (and the calculation of A just before it) is the issue:

https://github.com/rbchan/unmarked/blob/5063b596ad880b1cba772090c1e48eb13a7c7bdd/R/gmultmix.R#L118

kenkellner commented 1 year ago

I implemented the change in this branch. It did increase the maximum counts that could be handled, but not enough to actually solve the issue the user was having. I'm not sure if it's worth merging since this is something of an outlier problem.

rbchan commented 1 year ago

@kenkellner Did the change slow down the likelihood calculation substantially? If so, I suppose I wouldn't merge it.

kenkellner commented 1 year ago

It's about the same speed as before. We know the current code works for the vast majority of situations - I suppose there isn't much reason to risk new bugs by merging this.

rbchan commented 1 year ago

Ok merge on