MLB query for team total

424 views
Skip to first unread message

GoodBadUgly

unread,
May 26, 2017, 12:12:48 PM5/26/17
to SportsDataBase

Hello everyone. I'm new to SDQL and first time posting here.

Let's say we have this simple query to generate plays: D and o:R1 = 0 and op:R1 > 0. This will give us the dog play. We also want to see how often this dog team goes over its team total when there is a play. I'm guessing that there's a formula to come up with the team total based on the game total and/or game moneylines. How do we query this?

Please let me know if my questions are unclear. Thank you so much for your help and time.

Ognj3n

unread,
May 26, 2017, 12:51:21 PM5/26/17
to SportsDataBase
Okay, the question is clear. It would be the dps and dpa shortcut ( delta points scored and allowed ) in football and basketball.
The sportsdatabase doesn't have projected team totals in MLB or projected team goals in the NHL ( it would inherit uneven odds probably )
so I googled a bit and found this :


Rotogrinders :

Each team’s projected runs would then be calculated with the following formula:

= (SPREAD + TOTAL RUNS/2) + ((Spread Moneyline Probability Percent * Projected Runs)/2)

Twoplustwo:
Let A = the projected/implied runs scored for Team A
Let B = the projected/implied runs scored for Team B
Let X = projected/implied win pct for Team A (in your example X = .65)
Let R = the project/implied runs scored for both teams (in your example R = 8)
Let P = the pythagorean exponent you want to use (in your example P = 1.8)
It is straightforward algebra to solve for A (of course, B = R - A):
Let Q = [X/(1-X)]^(1/P) where ^ is exponentiation
Then A = R * Q / (1 + Q)

GoodBadUgly

unread,
May 27, 2017, 2:19:34 PM5/27/17
to SportsDataBase

Thank you, Ognj3n, for your help.

To be honest, I don't know how to write a query that includes all the parameters from the Rotogrinders or the Twoplustwo formula and that it will work.

Does my query below make sense?

runs >= (total/2 +1)

We want this query to tell us that our team's total runs for the game is greater than or equal to the sum of (game total divided by 2) +1. Example: game total is 8; query is true if our team's total run is five or more. Thanks.

Ognj3n

unread,
May 28, 2017, 2:45:19 AM5/28/17
to SportsDataBase
Okay, let's see it for Dogs as You inquired in the first post.
This will give You a roughly right result :
D and 2*runs>=(total-1)
http://sportsdatabase.com/mlb/query?output=default&su=1&ou=1&sdql=season%3D2017+and+D+and+2*runs%3E%3D%28total-1%29&submit=++S+D+Q+L+%21++

GoodBadUgly

unread,
May 28, 2017, 5:50:41 AM5/28/17
to SportsDataBase
What does the 2*runs>=(total-1) translate to in English?

Generally, in baseball, with regards to individual team totals set by the line makers, the dog team is usually assigned half of the game total; hence (total/2). I add 1 to that quotient just to be conservative; hence (total/2 +1). Does runs >= (total/2 +1) translate to our team's total score for the game is >= the sum of the total for the game divided by two plus one? I hope my questions are clear. Thanks.

Ognj3n

unread,
May 28, 2017, 10:38:04 AM5/28/17
to SportsDataBase
The average result in the database is team Fav -team Dog 4.81-4.14, hence average margin is 0.67 for the favored team,
for the sake of simpicity we rounded it up to 1
So average total is 9, team total for the Fave would be 5 runs, for the Dog it would be 4 runs. In the average situation.
So if You want the Dog to score more runs than the team total, they should score X, with 2*X>=total-1 or X>=(total-1)*0.5 if You want.
If You want the margin to be more precise than 1 ( rounded up) , you have the formulas with exponents above,
or if You were a lazy bum like me, use the sportdatabase, type the desired line ( say -120 for example ) :
http://sportsdatabase.com/mlb/query?output=default&su=1&ou=1&sdql=line%3D-120&submit=++S+D+Q+L+%21++
and read the average margin in the top left corner , here it's 0.24
SU:

1274-1125 (0.24, 53.1%)




RL: 677-1109 (-1.22, 37.9%)



GoodBadUgly

unread,
May 28, 2017, 3:20:57 PM5/28/17
to SportsDataBase

Thank you very much, Ognj3n.

 

I'm slowly grasping your logic now. The way my brain works, I understand the X>=(total-1)*0.5 example more. (X being the total runs scored by the team, either dog or fav.)

 

Ognj3n, for the Favorite team, we need to change from X>=(total-1)*0.5 to X>=(total+1)*0.5, correct? Thank you.

Ognj3n

unread,
May 29, 2017, 3:57:42 AM5/29/17
to SportsDataBase
>> for the Favorite team, we need to change from X>=(total-1)*0.5 to X>=(total+1)*0.5

Exactly, np.
Reply all
Reply to author
Forward
0 new messages