Table of Contents
|
Here, I attempt to describe some of the more common errors that can crash BioGeoBEARS analyses. See also the BioGeoBEARS google group for help — be sure to search the group on your error message, probably someone has encountered it before.
Copy/paste errors
On some operating systems I've see large copy-paste operations (e.g., into the Terminal window running R, on a Mac) skip a few characters randomly. The result is commands getting cut and stuck together, like this:
> # However, you can find the extdata directory like this:
> extdata_dir = np(extdem.file("extdata", package="BioGeoBEARS"))
Error in path.expand(path) : could not find function "extdem.file"
This should have been:
# However, you can find the extdata directory like this:
extdata_dir = np(system.file("extdata", package="BioGeoBEARS"))
extdata_dir
In a large copy/paste, the error may go by so quickly you don't see it, and then cause later errors downstream. Sometimes, it may be that an analysis doesn't run, and therefore you use old results/old PDFs when you think you are looking at new results.
Similar errors can be caused when you absent-mindedly forget to paste a line, or part of a line.
Solutions:
- Watch carefully for these sorts of errors when you copy/paste.
- Copy/paste smaller chunks
- Run the whole script from the Terminal, via e.g.:
R CMD BATCH scriptname.R
Rscript scriptname.R
These commands on defaults will either save the terminal output to a file, or print it to screen. For advice on avoiding this (if desired; usually you want it), see: [R CMD BATCH *without* saving output http://r.789695.n4.nabble.com/R-CMD-BATCH-without-saving-output-td4694498.html]
Crashes / NaNs produced due to machine precision / underflow issues
NOTE: All of this section constitutes my informed guess at what is going on when this error occurs. I am not an official computer scientist, nor an expert on the insides of R or how these might vary on all of the different computer systems people run R on. So: I Might Be Wrong, and Comments From People Who Know More are welcome.
The problem: Errors like this are sometimes observed:
rexpokit::expokit_dgpadm_Qmat(Qmat = Qmat, t =
times, transpose_needed) : NA/NaN/Inf in foreign
function call (arg 4)
Here is another one:
Error in eigen(nhatend) : infinite or missing values in 'x'
In addition: Warning messages:
1: In log(computed_likelihoods_at_each_node) : NaNs produced
2: In log(computed_likelihoods_at_each_node) : NaNs produced
3: In log(computed_likelihoods_at_each_node) : NaNs produced
4: In log(computed_likelihoods_at_each_node) : NaNs produced
Error in -details[[i, "hev"]] : invalid argument to unary operator
In addition: Warning message:
In optimx.run(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower, :
Eigenvalue failure after method bobyqa
These sorts of errors seem to usually be due to machine precision issues, also called underflow errors.
Background on machine precision / underflow issues
Background on "machine precision": Numbers in computers are, fundamentally, represented in binary — a series of bits, where each bit can take the value 0 or 1. This means that numbers with more precision require more bits — more space on the computer. Numbers with more precision will take more space. If you take a computer science class, this is one of the things you will be taught, but it may well be new to many biologists.
Because of machine precision, computers have different types of numbers: integers, long integers, floating point, "double" (double-precision floating-point), etc. Numbers with more precision require more bytes to store, and will take more computing time for the computer to process. For more information on this, see e.g. Wikipedia on single-precision floating point.
In "hard core" computing languages like C++, the programmer will decide ahead of time when different types of numbers will be used ("casting" or "typing" the numbers), and will also specify when conversions have to be made. This makes the code run faster, but makes programming much slower and more technical.
In more user-friendly languages like R, all of this "casting" or "typing" happens in the background. This is great because the programmer does not have to worry about it (usually), and it makes programming much easier, but this is one of the reasons that R programs run more slowly than equivalent programs in C++.
Background on "underflow": Because of limited precision on computers, numbers can only be so big or so small under a particular representation. In general, R is very good at managing these issues, but you can push it to the limit quite easily, if you know where to look.
For example, on my computer's version of R (64-bit Mac Pro), typing 1e-323 (or 1*10^-323) yields 9.881313e-324. Disturbingly, this is not exactly the same as the input 1e-323, and indicates we are near the minimum precision limit. If instead we type 1e-324, we get 0 returned. This is even worse, for example because dividing by 0 is undefined; in R, dividing something by 0 produces Inf (infinity). Again disturbingly, we know that 1e-323 is ten times bigger than 1e-324. So we know what the answer to 1e-323/1e-324 should be: it should just be 10. But if you type 1e-323/1e-324 into my computer, it thinks of it as 9.881313e-324/0, and produces the result Inf. This result is not just wrong, it's infinitely wrong!
(You should try this yourself on your own computer, and see where the default precision limit is; it might be different from my computer!)
This is an example of what is sometimes called an underflow error. Even worse ones are imaginable, for example where some calculation should produce a very small number, but instead produces a negative number. If the numbers are supposed to be probabilities, this result is Very Bad, because probabilities cannot be negative. For more, see Wikipedia on arithmetic underflow.
How the problem arises in BioGeoBEARS
BioGeoBEARS, in order to speed up the slowest parts of the likelihood calculations, uses C++ (via the cladoRcpp package) and C++ and FORTRAN (via the rexpokit package) to perform some calculations more quickly. The "NaNs produced" error, when it occurs, seems to originate somewhere at this interface between R, C++, and FORTRAN. Furthermore, when it occurs, it seems to be machine-specific: R is cross-platform, and so are C++ and FORTRAN, but the latter two may be differently compiled on different operating systems, and the compilers may make different decisions about exactly how precision is treated. Usually, I cannot replicate someone's reported problem on my own computer (this may be because I have a very new, 64-bit Mac).
The problem seems to be more common in these situations:
- Windows machines
- Older machines
- "Bad" models (models that fit much more poorly than the others — most commonly BAYAREALIKE is a much poorer fit, on many datasets)
- "Complex" biogeography: many areas, and thus very large state spaces
- "Complex" setups: many constraints / stratified analyses / strong constraints on areas allowed, dispersal rates, etc.
The usual way the error is observed is that the Maximum Likelihood (ML) search progresses as normal for awhile, trying different values of d, e, and whatever other parameters the user has set to be free. BioGeoBEARS uses either the optim() or optimx() function to conduct this ML search (as specified by the user via the use_optimx option). What these functions are doing is proposing different values of the parameters, calculating the log-likelihood under them, and then iteratively trying other parameter values to see if the log-likelihood improves. This is the classic Maximum Likelihood "heuristic search."
All of this is fine, unless some particular guess at parameter values causes such small probabilities somewhere in the calculation that an underflow error occurs. This could produce a negative probability, an Inf, and/or a NaN (Not a Number) somewhere in the C++ or FORTRAN, which spits an error back to R, which produces a crash.
Usually, in addition to the situations above, the parameter values that are being guessed are "particularly bad" parameter guesses — very small or very large, often near the user-specified limits of the parameters. For both optim() and optimx() in BioGeoBEARS, the "constrained search" option is being used, where each free parameter has limits. These limits are specified by the user in the "min" and "max" columns of the parameters table in the BioGeoBEARS model object. You can see this parameters table with:
BioGeoBEARS_run_object$BioGeoBEARS_model_object@params_table
For reasons that I do not understand — perhaps machine precision, or perhaps something about optim()/optimx()'s attempts to build up the likelihood surface by trying different points — optim() or optimx() may try parameter values just outside of the user-specified limits. As the parameters are usually rates or weights, this could be Very Bad, as negative rates and negative probabilities don't make sense and can cause crashes.
Solution #1: Change the min/max of the parameters
The solution: The most common, and very successful, solution is to change the min/max bounds on d/e/j (or other parameters) so that they are a little further from 0 or the theoretical max. Usually NaNs occur when the optimx package tries to explore some value that causes some super-small calculated probability that (this is my guess) causes a precision underrun and gets misread as 0 or negative.
Changing the min/max seems to fix the problem because: raising the "min" makes it less likely or impossible that the optim/optimx packages will try values significantly beyond the limit, especially values below 0. Lowering the "max" can have the same effect, in cases where the parameters have theoretical limits.
(Note: in the classic DEC+J format, "j" is a weight that can range between 0 and 3. This means that values above 3 don't make sense, just like values below 0. So, if you change minimum j from, say, 0.00001 to 0.001, I would recommend changing maximum j from 2.99999 to 2.999, just to be self-consistent. However, I suspect that it is the "min" border that is usually the one causing problems.)
(Note also: the limits on "j" should change for DIVALIKE+J (j is between 0 and 2), and BAYAREALIKE+J (j is between 0 and 1). This is because of the numbers of other types of cladogenetic events allowed in these models. See the example script for more details.)
Example code for changing the limits on a parameter:
# Just as you can access the variable type for "j", the initial starting value of "j", etc., like this:
BioGeoBEARS_run_object$BioGeoBEARS_model_object@params_table["j","type"] = "free"
BioGeoBEARS_run_object$BioGeoBEARS_model_object@params_table["j","init"] = 0.01
# ...you can access the "min" and "max" for "j" (or "d", "e", whatever), like this:
BioGeoBEARS_run_object$BioGeoBEARS_model_object@params_table["j","min"]
BioGeoBEARS_run_object$BioGeoBEARS_model_object@params_table["j","max"]
# Often, narrowing the limits a teeny bit fixes NaN/Inf problems during the ML search.
#
# You can access the full parameters table with:
BioGeoBEARS_run_object$BioGeoBEARS_model_object@params_table
Solution #2: Use parameter scaling (beta)
Another possible solution is to use parameter scaling. Here, each free parameter is auto-transformed into a number using a logit transformation (which will change a number on e.g. a 0-1 scale, into a number between -Inf and +Inf; this can be modified to replace 0 and 1 with the user-specified min and max). It is then auto-transformed back into the original parameter space for use in the likelihood calculation.
You can try parameter scaling with:
BioGeoBEARS_run_object$rescale_params = TRUE
This should help with the precision underflow issue. However, I have not extensively tested it, so this should be regarded as a beta feature.
Parameter scaling also help with "scaling" warnings sometimes issued by optim() or optimx() when, say, one parameter ranges between 0.001 and 1, and another ranges between 0.001 and 100. The heuristic search methods used by optim() and optimx() are happiest when all parameters have the same scaling.
This might be particularly useful when likelihood surfaces are quite flat for one parameter — I have noticed this sometimes with "+w" models, where dispersal probabilities are being scaled by (manual dispersal multipliers)^w, and sometimes ML with the +w model gets a log-likelihood worse than the log-likelihood found by the default model without w (!!). However, again, I have not tested this extensively.
As always, when running heuristic ML searches, researchers should always be thinking and should always watch out for optimization problems, with BioGeoBEARS or any other program using heuristic ML or Bayesian searches. Some advice on this is found in Issues with Maximum Likelihood (ML) optimization and ML optimization routines and their pitfalls.
NaNs due to impossible constraints/model combination
If you get an error like this:
> runslow = TRUE
> resfn = "DIVALIKE_M1_constrained_v1.Rdata"
> if (runslow)
+ {
+ res = bears_optim_run(BioGeoBEARS_run_object)
+ res
+
+ save(res, file=resfn)
+ resDIVALIKE = res
+ } else {
+ # Loads to "res"
+ load(resfn)
+ resDIVALIKE = res
+ }
Read 10 items
Read 46 items
NOTE: Before running optimx(), here is a test calculation of the data likelihood
using calc_loglike_for_optim() on initial parameter values...
if this crashes, the error messages are more helpful
than those from inside optimx().
Read 10 items
Read 46 items
independent likelihood %*% relative_probs_of_each_state_at_branch_top_AT_node_DOWNPASS returned NaNs:
i= 19
phy2$edge.length[i]= 0.5437831
print(condlikes_Left):
[,1]
[1,] NaN
[2,] NaN
[3,] NaN
[4,] NaN
[5,] NaN
[6,] NaN
[7,] NaN
[8,] NaN
[9,] NaN
[10,] NaN
[11,] NaN
[12,] NaN
[13,] NaN
[14,] NaN
[15,] NaN
[16,] NaN
[17,] NaN
[18,] NaN
[19,] NaN
[20,] NaN
[21,] NaN
[22,] NaN
[23,] NaN
[24,] NaN
[25,] NaN
[26,] NaN
[27,] NaN
[28,] NaN
[29,] NaN
[30,] NaN
[31,] NaN
[32,] NaN
[33,] NaN
[34,] NaN
[35,] NaN
[36,] NaN
[37,] NaN
print(relative_probs_of_each_state_at_branch_top_AT_node_DOWNPASS):
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00
[2,] 0 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[3,] 0 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[4,] 0 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00
[5,] 0 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[6,] 0 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[7,] 0 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[8,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[9,] 0 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[10,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[11,] 0 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[12,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[13,] 0 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[14,] 0 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[15,] 0 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[16,] 0 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00
[17,] 0 0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00
[18,] 0 0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00
[19,] 0 0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00
[20,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[21,] 0 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[22,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[23,] 0 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[24,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[25,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[26,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[27,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[28,] 0 6.345088e-10 6.646020e-01 1.549357e-04 2.360043e-14 2.360043e-14
[29,] 0 8.605408e-13 2.689876e-04 2.778863e-04 8.623524e-13 8.623524e-13
[30,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[31,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[32,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[33,] 0 8.485914e-12 6.629421e-01 8.436944e-12 5.312453e-24 5.312453e-24
[34,] 0 3.269116e-16 1.122538e-05 3.250169e-16 7.411947e-28 7.411947e-28
[35,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[36,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[37,] 0 1.460383e-12 3.157660e-04 1.432678e-12 4.232654e-22 4.232654e-22
[38,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[39,] 0 2.704469e-04 2.466844e-03 3.556716e-13 2.477637e-24 2.477637e-24
[40,] 0 6.726072e-01 6.082265e-05 3.052194e-14 1.835768e-24 1.835768e-24
[41,] 0 1.817088e-19 5.297211e-11 1.085173e-03 1.120958e-03 6.172355e-07
[42,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[43,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[44,] 0 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[45,] NaN NaN NaN NaN NaN NaN
[,7] [,8] [,9] [,10] [,11]
[1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[2,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[6,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[7,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[8,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[9,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[10,] 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00
[11,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[12,] 0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00
[13,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[14,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[15,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[16,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[17,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[18,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[19,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[20,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[21,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[22,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[23,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[24,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[25,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[26,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[27,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[28,] 6.293003e-10 6.293003e-10 6.345088e-10 7.938864e-05 7.856234e-05
[29,] 8.530698e-13 8.530698e-13 8.605408e-13 2.197727e-08 1.404696e-04
[30,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[32,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[33,] 9.515459e-06 9.515459e-06 8.485914e-12 9.533746e-06 8.461412e-12
[34,] 1.714181e-05 1.714181e-05 3.269116e-16 1.059251e-10 3.259631e-16
[35,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[36,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[37,] 1.446500e-12 1.446500e-12 3.391064e-04 3.110603e-08 1.446469e-12
[38,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[39,] 3.578213e-13 3.578213e-13 3.599733e-13 9.967240e-01 1.337796e-04
[40,] 3.071137e-14 3.071137e-14 3.090138e-14 3.272902e-01 1.039381e-05
[41,] 1.796768e-19 1.796768e-19 1.817088e-19 3.443403e-15 2.933241e-11
[42,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[43,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[44,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[45,] NaN NaN NaN NaN NaN
[,12] [,13] [,14] [,15] [,16]
[1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[2,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[6,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[7,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[8,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[9,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[10,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[11,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[12,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[13,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[14,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[15,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[16,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[17,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[18,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[19,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[20,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[21,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[22,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[23,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[24,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[25,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[26,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[27,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[28,] 3.192031e-10 3.192031e-10 6.319018e-10 6.319018e-10 6.345088e-10
[29,] 1.922933e-08 1.922933e-08 8.567977e-13 8.567977e-13 8.605408e-13
[30,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[32,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[33,] 2.019176e-17 2.019176e-17 4.769542e-06 4.769542e-06 8.485914e-12
[34,] 5.921050e-22 5.921050e-22 8.587513e-06 8.587513e-06 3.269116e-16
[35,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[36,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[37,] 2.753106e-17 2.753106e-17 1.453426e-12 1.453426e-12 1.695532e-04
[38,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[39,] 2.926674e-09 2.926674e-09 1.345016e-04 1.345016e-04 1.352235e-04
[40,] 9.881210e-11 9.881210e-11 1.042961e-05 1.042961e-05 1.046541e-05
[41,] 5.056572e-08 2.784411e-11 1.806900e-19 1.806900e-19 1.817088e-19
[42,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[43,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[44,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[45,] NaN NaN NaN NaN NaN
[,17] [,18] [,19] [,20] [,21]
[1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[2,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[6,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[7,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[8,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[9,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[10,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[11,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[12,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[13,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[14,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[15,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[16,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[17,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[18,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[19,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[20,] 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[21,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[22,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[23,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[24,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[25,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[26,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[27,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[28,] 3.346107e-01 1.362069e-06 1.362069e-06 7.884354e-05 7.884354e-05
[29,] 9.986191e-01 1.367041e-04 1.367041e-04 2.186449e-08 2.186449e-08
[30,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[32,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[33,] 9.487158e-06 4.340648e-11 4.340648e-11 1.684861e-01 1.684861e-01
[34,] 1.055337e-10 2.793176e-16 2.793176e-16 4.999429e-01 4.999429e-01
[35,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[36,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[37,] 3.075614e-08 7.686302e-13 7.686302e-13 3.093110e-08 3.093110e-08
[38,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[39,] 1.668741e-07 3.622110e-12 3.622110e-12 1.677683e-07 1.677683e-07
[40,] 1.446353e-09 1.222213e-14 1.222213e-14 1.451002e-09 1.451002e-09
[41,] 3.441390e-07 5.425252e-04 2.987591e-07 3.422709e-15 3.422709e-15
[42,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[43,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[44,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[45,] NaN NaN NaN NaN NaN
[,22] [,23] [,24] [,25] [,26]
[1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[2,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[6,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[7,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[8,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[9,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[10,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[11,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[12,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[13,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[14,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[15,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[16,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[17,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[18,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[19,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[20,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[21,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[22,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[23,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[24,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[25,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[26,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[27,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[28,] 7.938864e-05 3.219112e-09 3.219112e-09 7.801528e-05 7.801528e-05
[29,] 2.197727e-08 2.217010e-08 2.217010e-08 1.397064e-04 1.397064e-04
[30,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[32,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[33,] 9.533746e-06 2.017276e-17 2.017276e-17 4.745926e-06 4.745926e-06
[34,] 1.059251e-10 5.907050e-22 5.907050e-22 8.554297e-06 8.554297e-06
[35,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[36,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[37,] 9.986708e-01 2.729685e-17 2.729685e-17 1.439574e-12 1.439574e-12
[38,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[39,] 1.686625e-07 3.947109e-18 3.947109e-18 3.567458e-13 3.567458e-13
[40,] 1.455651e-09 2.416341e-19 2.416341e-19 3.061651e-14 3.061651e-14
[41,] 3.443403e-15 9.961403e-01 5.488119e-04 2.914402e-11 2.914402e-11
[42,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[43,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[44,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[45,] NaN NaN NaN NaN NaN
[,27] [,28] [,29] [,30] [,31]
[1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[2,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[6,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[7,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[8,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[9,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[10,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[11,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[12,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[13,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[14,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[15,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[16,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[17,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[18,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[19,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[20,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[21,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[22,] 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[23,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[24,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[25,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[26,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[27,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[28,] 7.856234e-05 2.360043e-14 3.169804e-10 3.169804e-10 3.192031e-10
[29,] 1.404696e-04 8.623524e-13 1.912485e-08 1.912485e-08 1.922933e-08
[30,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[32,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[33,] 8.461412e-12 5.312453e-24 2.205189e-11 2.205189e-11 2.019176e-17
[34,] 3.259631e-16 7.411947e-28 2.419783e-11 2.419783e-11 5.921050e-22
[35,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[36,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[37,] 1.675345e-04 4.232654e-22 2.741396e-17 2.741396e-17 4.569304e-09
[38,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[39,] 3.578200e-13 2.477637e-24 3.949921e-18 3.949921e-18 3.952732e-18
[40,] 3.071108e-14 1.835768e-24 2.423660e-19 2.423660e-19 2.430979e-19
[41,] 2.933241e-11 5.607877e-04 5.023521e-08 5.023521e-08 5.056572e-08
[42,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[43,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[44,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[45,] NaN NaN NaN NaN NaN
[,32] [,33] [,34] [,35] [,36]
[1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[2,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[6,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[7,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[8,] 0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00
[9,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[10,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[11,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[12,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[13,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[14,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[15,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[16,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[17,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[18,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[19,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[20,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[21,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[22,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[23,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[24,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[25,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[26,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[27,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[28,] 3.169804e-10 3.169804e-10 3.192031e-10 6.293003e-10 6.319018e-10
[29,] 1.912485e-08 1.912485e-08 1.922933e-08 8.530698e-13 8.567977e-13
[30,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[31,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[32,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[33,] 2.205189e-11 2.205189e-11 2.019176e-17 9.515459e-06 4.769542e-06
[34,] 2.419783e-11 2.419783e-11 5.921050e-22 1.714181e-05 8.587513e-06
[35,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[36,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[37,] 2.741396e-17 2.741396e-17 4.569304e-09 1.446500e-12 1.685439e-04
[38,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[39,] 3.949921e-18 3.949921e-18 3.952732e-18 3.578213e-13 3.588967e-13
[40,] 2.423660e-19 2.423660e-19 2.430979e-19 3.071137e-14 3.080623e-14
[41,] 2.766212e-11 2.766212e-11 2.784411e-11 1.796768e-19 1.806900e-19
[42,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[43,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[44,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
[45,] NaN NaN NaN NaN NaN
[,37]
[1,] 0.000000e+00
[2,] 0.000000e+00
[3,] 0.000000e+00
[4,] 0.000000e+00
[5,] 0.000000e+00
[6,] 0.000000e+00
[7,] 0.000000e+00
[8,] 0.000000e+00
[9,] 0.000000e+00
[10,] 0.000000e+00
[11,] 0.000000e+00
[12,] 0.000000e+00
[13,] 0.000000e+00
[14,] 0.000000e+00
[15,] 0.000000e+00
[16,] 0.000000e+00
[17,] 0.000000e+00
[18,] 0.000000e+00
[19,] 0.000000e+00
[20,] 0.000000e+00
[21,] 0.000000e+00
[22,] 0.000000e+00
[23,] 0.000000e+00
[24,] 0.000000e+00
[25,] 0.000000e+00
[26,] 0.000000e+00
[27,] 0.000000e+00
[28,] 6.319018e-10
[29,] 8.567977e-13
[30,] 0.000000e+00
[31,] 0.000000e+00
[32,] 0.000000e+00
[33,] 4.769542e-06
[34,] 8.587513e-06
[35,] 0.000000e+00
[36,] 0.000000e+00
[37,] 1.685439e-04
[38,] 0.000000e+00
[39,] 3.588967e-13
[40,] 3.080623e-14
[41,] 1.806900e-19
[42,] 0.000000e+00
[43,] 0.000000e+00
[44,] 0.000000e+00
[45,] NaN
print(relative_probs_of_each_state_at_branch_top_AT_node_DOWNPASS[left_desc_nodenum,]):
[1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[20] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
Error in calc_loglike_sp(tip_condlikes_of_data_on_each_state = tip_condlikes_of_data_on_each_state, :
Stopping on error. This may mean your transition matrix disallows necessary transitions. E.g., if your ranges are 'A' and 'B', and your model is DEC, then allowing range 'AB' as a possible state is required, so that you can get from 'A' to 'B' via 'AB' as the intermediate.
When the run crashes with lots of NAs, this can mean that the constraints + that specific model you are using make the data so unlikely on the starting parameters that precision underflow happens. (It can also happen on a later set of parameters sampled in the middle of the run.)
Typically, the way to fix this is by changing the 0s to 0.00001 in the dispersal matrix. This gives a little bit of probability to histories that formerly had zero probability, and this may allow the calculations to proceed even when the data conflicts a lot with the model.
E.g., change the dispersal multipliers file from this:
A B C D E F G H
1 1 0 0 0 0 0 0
1 1 1 0 0 1 1 1
0 1 1 1 1 0 0 0
0 0 1 1 1 0 0 0
0 0 1 1 1 0 0 0
0 1 0 0 0 1 1 0
0 1 0 0 0 1 1 0
0 1 0 0 0 0 0 1
END
…to this…
A B C D E F G H
1 1 0.00001 0.00001 0.00001 0.00001 0.00001 0.00001
1 1 1 0.00001 0.00001 1 1 1
0.00001 1 1 1 1 0.00001 0.00001 0.00001
0.00001 0.00001 1 1 1 0.00001 0.00001 0.00001
0.00001 0.00001 1 1 1 0.00001 0.00001 0.00001
0.00001 1 0.00001 0.00001 0.00001 1 1 0.00001
0.00001 1 0.00001 0.00001 0.00001 1 1 0.00001
0.00001 1 0.00001 0.00001 0.00001 0.00001 0.00001 1
END
Conceivably, this error could also result from constraints on the state space — e.g. disallowing certain areas/ranges that are necessary intermediate states. Again, playing with the constraints should help.