Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chula! Using all sorts of SAS to simulate and handicap jai-alai games for fun (and profit ???) Steve Grilli Life Office Management Association.

Similar presentations


Presentation on theme: "Chula! Using all sorts of SAS to simulate and handicap jai-alai games for fun (and profit ???) Steve Grilli Life Office Management Association."— Presentation transcript:

1 Chula! Using all sorts of SAS to simulate and handicap jai-alai games for fun (and profit ???) Steve Grilli Life Office Management Association

2 Presentation Outline Intro: Steven Skiena’s Calculated Bets Jai Alai -- The Game -- The Game -- Betting Terminology -- Betting Terminology -- Pari-mutuel Wagering -- Pari-mutuel Wagering -- How Games are Scored -- How Games are Scored Using SAS to Engineer the System -- Simulating Games -- Simulating Games -- Parsing Internet Files -- Parsing Internet Files -- Bet Selection Analysis -- Bet Selection Analysis SAS and Selected Research Issues -- Confidence Limits on small proportions -- Confidence Limits on small proportions -- “Hot hands” and players’ skill levels -- “Hot hands” and players’ skill levels -- Modelling mean payouts -- Modelling mean payoutsConclusions

3 DISCLAIMER “Fun” SAS application Not advocating gambling ! ! ! Internet gambling is considered illegal by US Dept. of Justice, and State of Georgia ! ! !

4 THE BOOK Calculated Bets: Computers, Gambling, and Mathematical Modeling to Win by Steven Skiena by Steven Skiena Professor of Computer Science Professor of Computer Science SUNY Stony Brook SUNY Stony Brook (Cambrigde University Press and Mathematical Association of America, 2001)

5 THE GAME OF JAI ALAI Originated in the Basque Region Originated in the Basque Region Players use a “basket” (cesta) to fire a hard ball (pelota) against a wall. Players use a “basket” (cesta) to fire a hard ball (pelota) against a wall. Must be caught and returned on the fly or one bounce Must be caught and returned on the fly or one bounce In U.S. eight players or doubles teams rotate In U.S. eight players or doubles teams rotate Pari-mutuel gambling allowed at fronton and off- site betting establishments Pari-mutuel gambling allowed at fronton and off- site betting establishments

6 BETTING TERMINOLOGY Money goes into POOLS Win, Place, Show Win, Place, Show Quinella Quinella Exacta (Perfecta) Exacta (Perfecta) Trifecta Trifecta

7 PARI-MUTUEL WAGERING Different from casino games where you play against the house Different from casino games where you play against the house No fixed odds No fixed odds Fronton (Jai Alai Stadium and its operators) take a cut of each pool off the top Fronton (Jai Alai Stadium and its operators) take a cut of each pool off the top Quite high (over 20%) Quite high (over 20%) Good news: they don’t care who wins Good news: they don’t care who wins More that’s wagered, the more the fronton makes More that’s wagered, the more the fronton makes

8 How Games Are Scored Eight players (or double teams) Eight players (or double teams) Color-coded Posts 1-8 Color-coded Posts 1-8 Player 1 serves to Player 2 Player 1 serves to Player 2 Winner of point stays on the court Winner of point stays on the court Loser goes to the end of the line Loser goes to the end of the line Next player in the queue takes the court Next player in the queue takes the court First time through rotation points worth one First time through rotation points worth one After all 8 players have taken the court points worth two After all 8 players have taken the court points worth two Games played to 7 or 9 points Games played to 7 or 9 points

9 Simulating Games 1: What Do We Need?  A basic player skill measure: Point- win Percentage (PTWPER)  A probability function that generates the probability that Player A with PTWPER-A wins the point against Player B with PTWPER-B

10 Simulating Games 2: The Probability Function Alpha is the key Alpha is the key Ex: Player A PTWPER = 0.525 Player B PTWPER = 0.475 Player B PTWPER = 0.475 Alpha= 1.0; A wins 52.5% Alpha= 0.4; A wins 65.1%

11 Simulating Games 3: SAS Code /* simulate winner */; /* simulate winner */; do until(win gt 0); do until(win gt 0); pt+1; pt+1; alpha=&alph; alpha=&alph; if wper(Op1) ge wper(Op2) then if wper(Op1) ge wper(Op2) then winop12=.5*(1 + (wper(Op1)- wper(Op2))**alpha); winop12=.5*(1 + (wper(Op1)- wper(Op2))**alpha); else winop12=.5*(1 - (wper(Op2)- wper(Op1))**alpha); else winop12=.5*(1 - (wper(Op2)- wper(Op1))**alpha); if ranuni(0) lt winop12 then do; if ranuni(0) lt winop12 then do; Ppt(Op1)+1; Ppt(Op1)+1; Ppt(Op2)+1; Ppt(Op2)+1; Pptw(Op1)+1; Pptw(Op1)+1; q(pt+6)=Op2; q(pt+6)=Op2; Op2=q(pt); Op2=q(pt); if pt le 7 then Sc(Op1)+1; if pt le 7 then Sc(Op1)+1; else Sc(Op1)+2; else Sc(Op1)+2; if Sc(Op1) ge game then do; if Sc(Op1) ge game then do; win=Op1; win=Op1; Sc(Op1)=-1; Sc(Op1)=-1; end; end; else do; else do; Ppt(Op1)+1; Ppt(Op1)+1; Ppt(Op2)+1; Ppt(Op2)+1; Pptw(Op2)+1; Pptw(Op2)+1; q(pt+6)=Op1; q(pt+6)=Op1; if pt le 7 then Sc(Op2)+1; if pt le 7 then Sc(Op2)+1; else Sc(Op2)+2; else Sc(Op2)+2; if Sc(Op2) ge game then do; if Sc(Op2) ge game then do; win=Op2; win=Op2; Sc(Op2)=-1; Sc(Op2)=-1; end; end; Op1=Op2; Op1=Op2; Op2=q(pt); Op2=q(pt); end; end; end; end;

12 Simulating Games 4: Some SAS Output GAME 6 GAME 6 PTWPER GACT TEAM POST PTWPER GACT TEAM POST 0.49598 93 JAIRO-LARREA 1 0.49598 93 JAIRO-LARREA 1 0.54231 77 LECUE-CHASIO 2 0.54231 77 LECUE-CHASIO 2 0.45431 104 TOTO-MADARIETA 3 0.45431 104 TOTO-MADARIETA 3 0.50832 82 SCOTTY-ERKIAGA II 4 0.50832 82 SCOTTY-ERKIAGA II 4 0.51901 64 OCHOA-PEDRO 5 0.51901 64 OCHOA-PEDRO 5 0.47931 68 OLATE-CARVALHO 6 0.47931 68 OLATE-CARVALHO 6 0.46634 30 BARRE-AZPIRI 7 0.46634 30 BARRE-AZPIRI 7 0.48200 122 ARECHA-URTARAN 8 0.48200 122 ARECHA-URTARAN 8

13 Simulating Games 4: More SAS Output The FREQ Procedure The FREQ Procedure Cumulative Cumulative Cumulative Cumulative EX Frequency Percent Frequency Percent EX Frequency Percent Frequency Percent 1-2 9495 3.80 9495 3.80 1-2 9495 3.80 9495 3.80 1-3 4606 1.84 14101 5.64 1-3 4606 1.84 14101 5.64 1-4 5443 2.18 19544 7.82 1-4 5443 2.18 19544 7.82 1-5 6382 2.55 25926 10.37 1-5 6382 2.55 25926 10.37 1-6 4219 1.69 30145 12.06 1-6 4219 1.69 30145 12.06 1-7 4040 1.62 34185 13.67 1-7 4040 1.62 34185 13.67 1-8 3747 1.50 37932 15.17 1-8 3747 1.50 37932 15.17 2-1 12541 5.02 50473 20.19 2-1 12541 5.02 50473 20.19 2-3 7509 3.00 57982 23.19 2-3 7509 3.00 57982 23.19 2-4 8429 3.37 66411 26.56 2-4 8429 3.37 66411 26.56 2-5 9609 3.84 76020 30.41 2-5 9609 3.84 76020 30.41 2-6 6408 2.56 82428 32.97 2-6 6408 2.56 82428 32.97 2-7 6250 2.50 88678 35.47 2-7 6250 2.50 88678 35.47 2-8 6536 2.61 95214 38.09 2-8 6536 2.61 95214 38.09

14 GAME 6 EXACTA SELECTIONS GAME 6 EXACTA SELECTIONS GDATE GTIME GM GT GPTS TYP SEL PR RET GDATE GTIME GM GT GPTS TYP SEL PR RET 16828 EVE 6 D 7 E 2-1 0.05016 1.16647 16828 EVE 6 D 7 E 2-1 0.05016 1.16647 16828 EVE 6 D 7 E 2-5 0.03844 1.06245 16828 EVE 6 D 7 E 2-5 0.03844 1.06245 Simulating Games 5: Bet Selection

15 Parsing Internet Files: Results Files GAME 6 GAME 6 2 Lecue-Chasio 9.40 4.40 4.20 2 Lecue-Chasio 9.40 4.40 4.20 1 Jairo-Larrea 5.40 3.60 1 Jairo-Larrea 5.40 3.60 5 Ochoa-Pedro 3.80 5 Ochoa-Pedro 3.80 QUINIELA 1-2 24.60 QUINIELA 1-2 24.60 EXACTA 2-1 101.70 EXACTA 2-1 101.70 TRIFECTA 2-1-5 221.60 TRIFECTA 2-1-5 221.60 SAS FUNCTIONS INDEX () INDEX () SCAN () SCAN () Also, conditional input statements Also, conditional input statements

16 Bet Selection Analysis GAME 6 ANALYSIS OF RET CUTOFFS GAME 6 ANALYSIS OF RET CUTOFFS RET N MEANPROF PERCOR TPROF COR LOWER UPPER RET N MEANPROF PERCOR TPROF COR LOWER UPPER 1.19 137 0.84672 0.058394 116.0 8 0.027991 0.10715 1.19 137 0.84672 0.058394 116.0 8 0.027991 0.10715 1.03 1443 0.66334 0.038808 957.2 56 0.029749 0.04971 1.03 1443 0.66334 0.038808 957.2 56 0.029749 0.04971 1.23 63 0.61905 0.063492 39.0 4 0.021809 0.14391 1.23 63 0.61905 0.063492 39.0 4 0.021809 0.14391 1.04 1294 0.61731 0.037867 798.8 49 0.028478 0.04932 1.04 1294 0.61731 0.037867 798.8 49 0.028478 0.04932 1.05 1152 0.55104 0.036458 634.8 42 0.026771 0.04847 1.05 1152 0.55104 0.036458 634.8 42 0.026771 0.04847 1.02 1618 0.54042 0.037083 874.4 60 0.028687 0.04713 1.02 1618 0.54042 0.037083 874.4 60 0.028687 0.04713 1.17 211 0.50616 0.052133 106.8 11 0.028010 0.08840 1.17 211 0.50616 0.052133 106.8 11 0.028010 0.08840 1.01 1790 0.44134 0.036313 790.0 65 0.028382 0.04574 1.01 1790 0.44134 0.036313 790.0 65 0.028382 0.04574 1.15 299 0.41271 0.046823 123.4 14 0.027085 0.07526 1.15 299 0.41271 0.046823 123.4 14 0.027085 0.07526 1.18 163 0.39264 0.049080 64.0 8 0.023473 0.09046 1.18 163 0.39264 0.049080 64.0 8 0.023473 0.09046 0.89 5330 0.36968 0.033396 1970.4 178 0.028823 0.03848 0.89 5330 0.36968 0.033396 1970.4 178 0.028823 0.03848 0.93 3854 0.35864 0.034510 1382.2 133 0.029092 0.04063 0.93 3854 0.35864 0.034510 1382.2 133 0.029092 0.04063 0.94 3538 0.35579 0.033917 1258.8 120 0.028329 0.04027 0.94 3538 0.35579 0.033917 1258.8 120 0.028329 0.04027

17 System Structure Summary Parse entries.txt file from fronton website Parse entries.txt file from fronton website Simulate games; select bets Simulate games; select bets Parse entry changes.txt file; resimulate any games with changes Parse entry changes.txt file; resimulate any games with changes Finalize bets Finalize bets Parse results.txt file Parse results.txt file Update SAS data sets (PTWPER, Mean Payouts, et. al.) Update SAS data sets (PTWPER, Mean Payouts, et. al.)

18 Research 1: Confidence Interval on Small Proportions 95% Jeffreys interval: LOWER=BETAINV(.025,COR+0.50,N-COR+0.50); LOWER=BETAINV(.025,COR+0.50,N-COR+0.50); UPPER= BETAINV(.975,COR+0.50, N-COR+0.50); UPPER= BETAINV(.975,COR+0.50, N-COR+0.50);

19 Research 2: “Hot Hand” and Player Skill Estimation Statisticians still argue about the existence of streaks in sports Statisticians still argue about the existence of streaks in sports If we had actual point-win data, we can conduct research If we had actual point-win data, we can conduct research Use GEE option in PROC GENMOD Use GEE option in PROC GENMOD Use PROC FACTOR to build a weighed index of long and short term PTWPER Use PROC FACTOR to build a weighed index of long and short term PTWPER

20 Research 3: Improving the Estimate of Mean Payout

21 CONCLUSIONS SAS works for the three major areas of this type of gaming application: parsing internet files, simulation of the games, and analysis & research Profit? System is still under construction, but profitable in terms of personal development as statistician and SAS programmer


Download ppt "Chula! Using all sorts of SAS to simulate and handicap jai-alai games for fun (and profit ???) Steve Grilli Life Office Management Association."

Similar presentations


Ads by Google