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

Possible rcolgem off-by-one error #35

Open rmcclosk opened 9 years ago

rmcclosk commented 9 years ago

This function at line 1239 gets the index of the sub-interval that h + hoffset lies in, when the interval [maxtime, mintime] is chopped up into FGY_RESOLUTION pieces.

fgyParms$get.index <- function(h) min(1 + fgyParms$FGY_RESOLUTION * (h + hoffset) / ( maxtime - mintime ), fgyParms$FGY_RESOLUTION )

But below (line 1311), we define the time axis as a sequence of length FGY_RESOLUTION to be (I think) the interval boundaries.

haxis <- seq(0, maxHeight, length.out=fgyParms$FGY_RESOLUTION)

This means that we have FGY_RESOLUTION interval boundaries, which means FGY_RESOLUTION - 1 intervals. This does not agree with the get.index function, which assumes there are FGY_RESOLUTION intervals.

The error introduced here is obviously negligible, so keeping the original behaviour for now.