Both covarion methods get the wrong likelihood because they do not scale branches to the expected number of substitutions. Instead, they scale branches to the expected number of state changes.
This PR fixes both covarion methods to get the correct likelihood on a test case by computing the averageRate() correctly. It is now possible to match HKY likelihoods when all clock_rates == 1 without setting rescale=FALSE.
This patch does not address issues where the matrix exponential diverges for weird parameter values. That will be next.
Both covarion methods get the wrong likelihood because they do not scale branches to the expected number of substitutions. Instead, they scale branches to the expected number of state changes.
This PR fixes both covarion methods to get the correct likelihood on a test case by computing the averageRate() correctly. It is now possible to match HKY likelihoods when all clock_rates == 1 without setting rescale=FALSE.
This patch does not address issues where the matrix exponential diverges for weird parameter values. That will be next.