Skip to content

Commit

Permalink
latent lik bug absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
brj1 committed Feb 17, 2023
1 parent 3151483 commit 8be891c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Binary file modified dist/BBD.addon.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions src/bbd/distributions/LatencyPrior.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public double calculateLogP() {

final double tMRCA = tree.getRoot().getDate();
final double rate = reactivationRate - latencyRate;
final double logRate = Math.log(rate);
final double logRate = Math.log(Math.abs(rate));
final double tMRCAFactor = Math.exp(rate * tMRCA);

for (final int i : taxonIndex) {
Expand All @@ -99,7 +99,7 @@ public double calculateLogP() {
// likelihood of going latent at `date` given sampling date
logP += rate * date +
logRate -
Math.log(Math.exp(rate * oriDate[k]) - tMRCAFactor);
Math.log(Math.abs(Math.exp(rate * oriDate[k]) - tMRCAFactor));
} else {
// not in range
return Double.NEGATIVE_INFINITY;
Expand Down

0 comments on commit 8be891c

Please sign in to comment.