hmorlon / PANDA

Phylogenetic ANalyses of DiversificAtion
24 stars 15 forks source link

issue with running sim_MCBD #32

Closed alexsla closed 4 years ago

alexsla commented 4 years ago

Hi,

There appears to be an issue with running sim_MCBD where simulations do not finish because of a 'subscript out of bounds' error. The error occurs on lines 67-70 of the function, where there is a test to examine whether the incipient lineage's sister species has a current trait value of NA. As far as I can tell, the error occurs when the focal incipient lineage's sister is either an internal branch or an extinct lineage, both cases in which it's not an active lineage and therefore the trait vector is too short, which causes the 'subscript out of bounds' error.

I haven't been able to figure out exactly why this occurs, but as far as I can tell it's something to do with re-assigning sister lineages during an extinction event.

Cheers, Alex

laristide commented 4 years ago

Hi Alex, thanks for writing. I'm aware of this problem, but it has been hard to fix because it's hard to reproduce. It would mostly happen when speciation initiation and incipient species extinction rates are both very high, which can lead to complex sister lineage re-assignation situations. However, this should not impact most simulations, so I think you can safely ignore those that fail or lower the rates if possible. In any case, if you have found parameter settings that would systematically lead to this error while the tree is still small, I could try to definitively fix it.

Best, Leandro