diff --git a/dist/BBD.addon.zip b/dist/BBD.addon.zip deleted file mode 100644 index e27abbd..0000000 Binary files a/dist/BBD.addon.zip and /dev/null differ diff --git a/src/bbd/distributions/LatencyPrior.java b/src/bbd/distributions/LatencyPrior.java index f07d708..56c77d7 100644 --- a/src/bbd/distributions/LatencyPrior.java +++ b/src/bbd/distributions/LatencyPrior.java @@ -79,7 +79,7 @@ public void initAndValidate() { @Override public double calculateLogP() { - if (!initialised) { + if (!initialised) { initialise(); } @@ -88,17 +88,18 @@ public double calculateLogP() { int k = 0; final double tMRCA = tree.getRoot().getDate(); - final double rate = reactivationRate - latencyRate; + final double rate = reactivationRate - latencyRate; + final double logRate = Math.log(rate); + final double tMRCAFactor = Math.log(rate * tMRCA); for (final int i : taxonIndex) { double date = tree.getNode(i).getDate(); if (date > tMRCA && date < oriDate[k]) { // likelihood of going latent at `date` given sampling date - logP += Math.exp(rate * date) * - rate / - (Math.exp(rate * oriDate[k]) - - Math.exp(rate * tMRCA)); + logP += rate * date + + logRate - + Math.log(Math.exp(rate * oriDate[k]) - tMRCAFactor); } else { // not in range return Double.NEGATIVE_INFINITY;