Yes, fitDiscrete may be having trouble with the bounds of the rate parameter's
search space.
If we denote the (possibly) offending function as:
fdResult<-fitDiscrete(xxx)
Then you can do this:
te<-try(fdResult<-fitDiscrete(xxx))
if(class(te)=="try-error") {
# do something if there is an error - maybe print a warning?
}
On May 20, 2011, at 2:07 PM, Alejandro Gonzalez wrote:
> Hi,
>
> I am trying to run simulations of evolution of discrete traits using
> fitDiscrete() in the package geiger. When the simulated data have very few
> changes in character state (or none) I get an error message:
> Error in fitDiscrete(phy, fcare[, i], model = "ER", data.names =
> row.names(fcare), :
> ERROR: No solution found. Does your tree contain zero-length tip branches?
>
> The tree has no zero-length branches and it works fine with simulated data
> under somewhat higher rates of change using the same phylogeny.
>
> My problem is that I would like to use a loop to run several simulated data
> sets. But the loop stops whenever fitDiscrete() finds itself with one of the
> problematic datasets involving very low or no changes in character state and
> there seems to be no way of extracting the parameter values of previous runs
> of the loop.
> I was wondering it there was a way of creating a loop using try and if to
> avoid the loop crashing when the function tries to estimate rate of
> transition for data simulated under low rates of change. In such cases I
> would like it to simply skip to the next column of simulated data in the loop.
>
> Cheers
>
> Alejandro
>
>
>
> __________________________________
>
> Alejandro Gonzalez Voyer
>
> Post-doc
>
> Estación Biológica de Doñana
> Consejo Superior de Investigaciones Científicas (CSIC)
> Av Américo Vespucio s/n
> 41092 Sevilla
> Spain
>
> Tel: + 34 - 954 466700, ext 1749
>
> E-mail: [email protected]
>
> Web page: https://docs.google.com/View?id=dfs328dh_14gwwqsxcg
>
> _______________________________________________
> R-sig-phylo mailing list
> [email protected]
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Luke Harmon
Assistant Professor
Biological Sciences
University of Idaho
208-885-0346
[email protected]
_______________________________________________
R-sig-phylo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo