Help deriving first partial derivative for expected return of group of wagers

dollarbillstern

New member
Joined
Jun 26, 2020
Messages
4
Hi all, as stated in the title, I'm attempting to solve for the first partial derivative for the expected return of a group of wagers in a parimutuel pool.

Wikipedia describes parimutuel betting as "a betting system in which all bets of a particular type are placed together in a pool; taxes and the "house-take" or "vigorish" are deducted, and payoff odds are calculated by sharing the pool among all winning bets." (link).

The expected return of a series of potential bets into a parimutuel pool with N combinations can then be calculated by the formula:
[MATH] \sum_{i=1}^N(\frac{Q(W + \sum_{j=1}^Nb_j)}{w_i + b_i} - 1)b_ip_i - (b_i(1 - p_i)) [/MATH]where [MATH]N[/MATH] is the number of combinations, [MATH]Q[/MATH] is the money returned to bettors by the house after taxes and vig (expressed as a percentage), [MATH]W[/MATH] is the total money wagered into the pool prior to our proposed bets, [MATH]w_i[/MATH] and [MATH]b_i[/MATH] are the money wagered on combination [MATH]i[/MATH] by the public (not including our wager) and on our wager, respectively (both values are in the range 0+), and [MATH]p_i[/MATH] is the probability that combination [MATH]i[/MATH] is the winner.

My first attempt at the partial derivative, after pushing the [MATH]b_ip_i[/MATH] term into the quotient, was:
[MATH]\frac{Q(Wp_i+\sum_{j\ne i}^N(b_j)p_i+2b_ip_i)(w_i+b_i)-Q(Wb_ip_i+\sum_{j=1}^N(b_j)b_ip_i))}{(w_i+b_i)^2}-1[/MATH]However, I checked the gradient using python's scipy package (scipy.optimize.check_grad), which compares the derived gradient with the numerically estimated version. The results were significantly different. After some attempts, I realized I calculated the gradient of the quotient
[MATH]Q(Wb_ip_i + (\sum_{j=1}^Nb_j)b_ip_i)[/MATH]incorrectly. With some help from friends, I was able to solve it as
[MATH]Q(Wp_i+\sum_{j=1}^N(b_jp_i+b_jp_j))[/MATH]However, when I replaced that in the application of the quotient rule from my original attempt, the check_grad result was still significantly different.

At this point, I'm stuck and wondering if pushing the [MATH]b_ip_i[/MATH] term into the quotient was appropriate given the interaction of [MATH]b_i[/MATH] in the summation. Any pointers or help would be greatly appreciated!
 
You say "partial derivative" but you don't seem to say with respect to which variable you are taking the derivative!
 
Ahhhh you're right, my apologies. The partial derivative with respect to [MATH]b_i[/MATH].

The intent is to find the set of bets which maximize expected return. It's easy enough to do numerically, but with thousands of combinations it can take a long time.
 
I've beaten my head against the wall for the past week, but I think I've finally been able to solve this. It has helped to think of this in both in more general, less mathematical terms, as well as part of a small example, where we only consider something like N = 2.

From a less mathematical perspective, it was useful to think about how a single bet interacts with the expected return. I was originally approaching the problem consdering only how a bet might impact ER by itself but not how the bet might influence how other bets impact ER. When I wrote out the explicit contributes for each bet, given only 2 bets, it slowly became clear what I was missing. This is where you'll often see the [MATH]i=k[/MATH] and [MATH]i\ne k[/MATH] notation when googling partial derivatives of nested summations :).

I've checked this using scipy's check_grad function and it works but any math experts, please feel free to compress the expression.

[MATH]\sum_{i=1}^N[Q(\frac{(Wp_i+\sum_{j=1}^N(b_jp_i)+b_ip_i)(w_i+b_i)-(Wb_ip_i+\sum_{j=1}^N(b_j)(b_ip_i)}{(w_i + b_i)^2}+\sum_{j\ne i}^N(\frac{b_jp_j}{w_j + b_j})) - 1][/MATH]
 
You are trying to find the "first partial derivative" with respect to what variable?
 
You are trying to find the "first partial derivative" with respect to what variable?
I provided the response before, that it was w/r/t the [MATH]b_i[/MATH] variables. Perhaps I'm misunderstanding what you're asking. Anyway, I was able to solve the problem.
 
Top