This package is for calculating the odds of different bets that one might place at a horse race. At the track, bookies set odds for each horse in the race in the format "Odds for : Odds against". When a horse is given "2:1" odds, then, the bookies are giving him a 1 out of 3 chance of winning. Our set of functions uses these given odds to generate the probabilities that a horse comes in 1st, 2nd, and 3rd places. It uses these probabilities to calculate the odds of other bets, such as the exacta, trifecta, box, and show (these are described in each functions man pages).

Our first case probability is relatively simple to calculate. We switch each horse's odds to a ratio out of 1. (.3333 for "2:1"). We then add up all of these ratios to get a sum and divide each horse's individual ratio by that sum to give us a relative probability. There's more on this in the generate_psodds function.

Calculating 2nd and 3rd place probability is more complicated. To do so, we use DA Harville's mathematical intuition (from Journal of the Amer. Stat. Assn. 1973). The "Harville method" that is outline in this paper gives a formula for the probability of winning a trifecta bet, where a better correctly picks the first, second, and third place horses in that order. The formula is:

where p1, p2, and p3 are the odds that horse 1, horse 2, and horse 3 have to win first place. This formula consists of three terms multiplied together to give a joint probability. The terms are:

To calculate the probability of a horse winning third place then, we can sum up the individual conditional probabilities (derived from p3/(1 - p1 - p2)) over every possible permutation of 1st and 2nd place ( with the horse in question removed). This will be a sum of (n-1) * (n-2) terms, where n is the number of horses in the race

Similarly, to calculate the probability of a horse winning second place, we sum up the individual conditional probabilities (derived from p2/(1 - p1)) over every possible 1st place winner (besides the horse in question). This will be a sum of n-1 terms, where n is the number of horses in the race.

To use this package, one will need a data frame containing a column entitled "Horse_Odds" which contains each horse's odds of winning in the form "Odds for : Odds against". It is imperative to have this column (WITH THE CORRECT TITLE) for the program to work. Other important columns can be generated by generate_psodds

stumash1/HorsePackage documentation built on May 26, 2017, 10:02 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.