-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Math (and other) issues in the R = 0 case #11
Comments
Thoughts @swo (who may remember the story behind the special case), @SamuelBrand1, or @seabbs? |
When are you sampling "exactly" 0? |
Great question, and I realize I left out context. This not something encountered in any MCMC, it's sort of encountered in maximum likelihood estimation for a bunch of chains of size 1. There it converges to very small So, this is sort of an attempt to answer to "what is the MLE for all singleton chains?" |
I think the way to choose is what makes the likelihood surface smooth? Like, it seems that so it would make conceptual sense and also wouldn't break anything mathematically to assert that |
We have some conflicting opinions in the code about$R = 0$ .
nbbp_ep
we error out if.dnbbp_subcrit
we have a special case forThere is also a related bug in
dnbbp
where theif (!condition_on_extinction)
should beif (!condition_on_extinction && any(is.infinite(x)))
. We don't need the mass of non-finite chains if there aren't any.(Found when working to resolve #7)
Much ado about math
Mathematically things get a bit fuzzy at$R = 0$ . From a mean/variance perspective, for the mean to be 0, the mass at all other values has to be 0, so the variance is 0, and you should have to have $k = \infty$ , rather than a free $k$ .
On the other hand, it seems sane enough to assert that at$R = 0$ with probability 1 the chain size is 1 (and with probability 0 any other size), making the extinction probability 1.
For the PMF, we use Blumberg and Lloyd-Smith (2013) Equation 9
![Image](https://private-user-images.githubusercontent.com/148902749/412930961-199f1b86-6b72-42a7-9301-4d7ec9f91434.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2OTQxNjYsIm5iZiI6MTczOTY5Mzg2NiwicGF0aCI6Ii8xNDg5MDI3NDkvNDEyOTMwOTYxLTE5OWYxYjg2LTZiNzItNDJhNy05MzAxLTRkN2VjOWY5MTQzNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNlQwODE3NDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05MTc4NTU2YTM5ZDg2MWM2N2I3ZjYxOGRkODNjMzhiODE4OTFiNGJhNGNiYTBlNDM0ODFlYzJlZTAwMjc2YmMwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.eSiu3QzT3Q73fkIgj8mRh30ZBq9zHZhk-0VfrfxK8vc)
At$R = 0$ , this becomes (for chain size $j$ )
which becomes, at$j = 1$
while for$j >= 2$ we get 0 raised to a positive integer power, so the whole thing becomes 0, regardless of $k$ .
R regards the log-PMF at 0 as
NaN
because it involves-Inf * 0
.Moving forward
I see two solutions:
dnbinom
.The text was updated successfully, but these errors were encountered: