In this document you can find some guidance on what to do if you get errors or weird results.

Errors and warning messages will typically occur when the algorithms that convert odds to probabilities fails to give a proper results. This does not necessarily mean that there is a bug in the algorithms, it is just as likely that the mathematical relationship between the odds and the underlying probabilities does not conform to the assumptions needed for the different methods to work.

In my experience, the following scenarios can often cause problems for at least some of the methods:

- Extremely large odds can often create problems.
- Many outcomes, such win-odds for competitions with many contestants.
- Very large bookamker margins.

When the conversion from odds to probabilities fail, or give inappropriate results, a warning will show that indicates what the problem might be. In addition, the output from the implied_probabilities function will contain a vector that indicates which lines there are problems.

Here is an example. In the code below there are 3 lines of 4-way odds that is converted to probabilities using the ‘additive’ method. The first of these odds fails to be properly converted and you get a warning saying ‘Probabilities outside the 0-1 range produced at 1 instances’.

The point of this example is not to ‘fix’ the results or tweak the algorithm to work. The algorithm works as it should, it is just that the mathematical relationship between the odds and the underlying probabilities does not work well with the additive method. The point is just to show how to find the problematic results, if they occur.

The methods ‘wpo’, and ‘bb’ doesn’t work with this set of odds either, but the rest does.

```
require(implied)
#> Loading required package: implied
#> If you find this package useful, please consider supporting the development at
#> https://ko-fi.com/opisthokonta
<- rbind(c(1.15, 5, 10, 25),
my_odds c(4.1, 4.2, 8.2, 2.1),
c(3.8, 4.7, 5.9, 2.3))
<- implied_probabilities(my_odds, method = 'additive')
my_probs #> Warning in implied_probabilities(my_odds, method = "additive"): Probabilities outside the 0-1 range produced at 1 instances.
```

The vector named “problematic” indicates that there is a problem in the first odds-line in the input.

```
$problematic
my_probs#> [1] TRUE FALSE FALSE
# Can also just list the line numbers
which(my_probs$problematic)
#> [1] 1
```

And if we look at the probabilities, you will see that the 4th probability in the first line is negative, which isn’t a valid probability.

```
$probabilities
my_probs#> [,1] [,2] [,3] [,4]
#> [1,] 0.8171739 0.1476087 0.0476087 -0.0123913
#> [2,] 0.2238676 0.2180604 0.1019164 0.4561556
#> [3,] 0.2431084 0.1927165 0.1494420 0.4147331
```

This warning means that some of the converted probabilities are outside the valid range of probabilities, which is between 0 and 1. Most likely a negative probability.

Unless there is an accompanying warning about uniroot-problems, there isn’t much to do about this, and you should conclude that the conversion method you have used is incompatible with the odds you have. Try another method.

This error can happen when using the methods ‘shin’, ‘or’, ‘power’, or ‘jsd’. These methods convert the odds to probabilities using an equations solver called uniroot. Uniroot does a search of possible values of the factor used in the methods, and finds the factor that gives correct probabilities (ie they sum to 1). Sometimes the solver cant find the probabilities.

There are two possible reasons for why the solver cant find the correct factor and the correct probabilities. The first reason (and the most likely) is that the method you have chosen simply does not have a valid solution. Unfortunately, there is not really much to do about it, other than using a different method.

The second reason could be that some of the settings used in the solver does not allow the algorithm to find the solution. You can change some of the settings in the uniroot solver via the uniroot_options argument in implied_probabilities().

The following uniroot settings can be changed: interval, maxit, tol and extendInt. Take a look at the help page for the uniroot function for more information about the different settings.

This warning sometimes occur with method ‘jsd’, when the odds are extreme or otherwise difficult to convert. This does not get flagged as problematic, because it might not actually be a problem. But you should check if the probabilities in question seem reasonable.

This error occurs when the naive implied probabilities sum to less than 1. The whole point of the conversion methods in this package is to convert odds to proper probabilities where the odds imply a total probability greater than 1, which gives the bookmaker’s an advantage. If they sum to less than one it means that the bookmaker’s odds are advantageous for the bettor. This is a very unlikely scenario, and it is most likely due to an error in your data processing pipeline.

The conversion methods might be made to work in this case, but I haven’t tried or tested it. This might cahnge in the future.

This warning can happen with method ‘shin’, and with shin_method = ‘js’. There are two possible fixes:

- Try to increase shin_maxiter from the default 1000 to something larger, like 2000.
- Change shin_method to ‘uniroot’.

This warning can happen with methods ‘shin’ and ‘bb’. I am actually not sure if the results should be considered unreliable, or if they can be useful. These are not flagged as problematic, and you need to look at the ‘zvalues’ in the output to see which ones are negative.