khabbazian / l1ou

Detection of evolutionary shifts in Ornstein-Uhlenbeck models
GNU General Public License v2.0
19 stars 7 forks source link

added missing option "quietly" for fit_OU #27

Closed cecileane closed 7 years ago

cecileane commented 7 years ago

This is to fix an error, which can be reproduced on this example:

library(l1ou)
library(geiger)
set.seed(120)
ntaxa = 10
tr = rcoal(ntaxa)
x = c(rnorm(5, 15, 1), rnorm(5, 15, 1)) # no shift: so shift.configuration=NULL below
names(x) = tr$tip.label
ll = adjust_data(tr, x, normalize=FALSE)
myzero = 0.0 # same error with 1e-16 or smaller.
# force alpha=0 below, which does not fit the data, hence numerical instability
fo = fit_OU(ll$tree, ll$Y, shift.configuration=NULL, criterion="pBIC",
            alpha.starting.value=myzero, alpha.upper=myzero, alpha.lower=myzero)

It returns this error with this traceback:

Error in !silent : invalid argument type
8. value[[3L]](cond)
7. tryCatchOne(expr, names, parentenv, handlers[[1L]])
6. tryCatchList(expr, classes, parentenv, handlers)
5. tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) ...
4. try(phylolm(Y ~ preds - 1, phy = tree, model = opt$root.model, starting.value = s, lower.bound = l, upper.bound = u), silent = opt$quietly)
3. my_phylolm_interface(tr, y, s.c, opt)
2. fit_OU_model(tree, Y, shift.configuration, opt)
1. fit_OU(ll$tree, ll$Y, shift.configuration = NULL, criterion = "pBIC", alpha.starting.value = myzero, alpha.upper = myzero, alpha.lower = myzero)