liamrevell/phytools

mcmMk should set likelihood to "fitMk" when data input is matrix

rdiaz02 opened this issue · 2 comments

Currently, if data input is matrix and geiger is installed, mcmcMk fails. This is the error

likelihood="fitDiscrete" doesn't work for data input as matrix.
Setting likelihood method to "fitMk".

Error in LIK(makeq(Q, index.matrix), root = "given", root.p = pi) : 
  could not find function "LIK"

It seems that the solution is to have, right after line 56

cat("Setting likelihood method to \"fitMk\".\n\n")
, a likelihood <- "fitMk" as is done in line 52
likelihood<-"fitMk"
immediately above. That this will work is evidenced by the fact that, without geiger installed, things run just fine.

Right now, however, in line 121

LIK<-fitDiscrete(tree,y,model=model,niter=1)$lik
LIK is assigned the value of fitDiscrete and that assignment is made because, not having set likelihood <- "fitMk", we still have likelihood == fitDiscrete.

P.S. I can make a pull request with this one-line change if deemed appropriate.

Fixed. Will push shortly.

(Oooops, forgot to say) Thanks!