ArtPoon / kamphir

Phylogenetic inference using a tree-shape kernel in an Approximate Bayesian Computation framework
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

Error in approx() #46

Closed ArtPoon closed 9 years ago

ArtPoon commented 9 years ago
173 0.95021 0.00000 0.89676 94753.06739 70323.79851 0.0833  0.02403 0.02324 0.000480.01704  1.16291 2.0453  0.0004  0.00037 8e-05   0.00037 0.10396 0.08178 0.91242 0.03685 1.24814
Error in approx(Amono, haxis, xout = runif(n - 1, 0, 1)) : 
  need at least two non-NA values to interpolate
rmcclosk commented 9 years ago

I'm about 90% sure this is because mu + gamma >> lambda here, so R0 < 1, and the epidemic dies out before one of the break points. This leaves you with all zeroes for deme size going in to the next phase, and then we divide by zero and it blows up.

Possible fixes:

  1. just put a try/catch around make.fgy
  2. set the prior to zero if mu + gamma > lambda
rmcclosk commented 9 years ago

Nope, I was wrong, it's a numerical integration problem. fgy

OK to change to "adams" integration method?

ArtPoon commented 9 years ago

Wow, that’s way off! Yes, please switch to adams.

On Jul 25, 2015, at 8:58 AM, Rosemary McCloskey notifications@github.com wrote:

Nope, I was wrong, it's a numerical integration problem. https://cloud.githubusercontent.com/assets/768594/8890167/1cbcc6f0-32ab-11e5-8b84-ea0f55b9edf3.png OK to change to "adams" integration method?

— Reply to this email directly or view it on GitHub https://github.com/ArtPoon/kamphir/issues/46#issuecomment-124856512.

rmcclosk commented 9 years ago

Changing to "adams" didn't work, I got a whole bunch of errors about integration not being successful. I think it worked better for this particular case but maybe it doesn't work better in general. Unless there are any better ideas, I'm just going to put a try/except around make.fgy.

ArtPoon commented 9 years ago

Yeah I had switched to rk4 when I encountered problems with adams before. Go with the try/except, thanks.

On Jul 25, 2015, at 12:31 PM, Rosemary McCloskey notifications@github.com wrote:

Changing to "adams" didn't work, I got a whole bunch of errors about integration not being successful. I think it worked better for this particular case but maybe it doesn't work better in general. Unless there are any better ideas, I'm just going to put a try/except around make.fgy.

� Reply to this email directly or view it on GitHub.