-
Notifications
You must be signed in to change notification settings - Fork 4
/
runsperinning.html
executable file
·59 lines (59 loc) · 3.36 KB
/
runsperinning.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Expected Runs in an Inning</title>
<!--#include virtual="/bootstraphead.html"-->
<meta name="viewport" content="width=device-width">
<link rel="canonical" href="https://gregstoll.com/~gregstoll/baseball/runsperinning.html" />
<style type="text/css">
td { text-align: right; }
</style>
</head>
<body>
<!--#include virtual="/navbar.html"-->
<div class="container">
<h1>Expected Runs in an Inning</h1>
<p><a href="#about">About this project</a></p>
<form action="javascript:void(0);">
<p><label for="outs">Outs: </label><select name="outs" id="outs" onchange="updateProbabilities();">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option></select></p>
<p><label for="runners">Runners on base: </label><select name="runners" id="runners" onchange="updateProbabilities();">
<option value="1">none</option>
<option value="2">1st</option>
<option value="3">2nd</option>
<option value="4">1st & 2nd</option>
<option value="5">3rd</option>
<option value="6">1st & 3rd</option>
<option value="7">2nd & 3rd</option>
<option value="8">loaded</option>
</select></p>
<p><b>Expected runs: </b><span id="outExpected"></span></p>
<table>
<tbody id="outTbody">
<tr><td>Loading...</td></tr>
</tbody>
</table>
</form>
<p><a href="https://www.microsoft.com/store/apps/9nblgggzkgt4"><img src="https://cmsresources.windowsphone.com/devcenter/en-us/legacy_v1/img/badgegenerator/English_wstore_black_258x67.png" alt="Download from Windows Store" /></a> <a href="http://www.windowsphone.com/s?appid=ab476634-9a24-4f0c-bc7a-4f65a12c33dd"><img src="DownloadWPMed.png" alt="Download from the Windows Phone Store" title="Download from the Windows Phone Store"></a></p>
<p id="about" style="margin-top: 20px;"><b>About this project:</b> This shows, for a given situation,
what the expected number of runs scored in the rest of the inning is,
as well as the historical distribution of runs.</p>
<p>This is based on the same data that the <a href="stats.html">Win Expectancy Finder</a> uses. The data is from MLB games from 1957-2023, including postseason games.</p>
<p>From a technical standpoint, I got to use <a href="http://www.wrox.com/WileyCDA/Section/id-291861.html">XPath</a> to select the elements from the XML
file.
Here are my source files, which are also available on <a href="https://github.com/gregstoll/baseballstats">GitHub</a>:</p>
<ul>
<li><a href="parseretrosheet.txt">parseretrosheet.py</a> - parses the <a href="http://www.retrosheet.org/game.htm">Retrosheet data</a> and generates the raw XML data.</li>
<li><a href="runsperinning.xml">runsperinning.xml</a> - the raw XML data</li>
<li><a href="runsperinning.js">runsperinning.js</a> - the Javascript file that gets the XML data and updates this page.</li>
</ul>
<p>The information used here was obtained free of charge from and is copyrighted by Retrosheet. Interested parties may contact Retrosheet at 20 Sunset Rd., Newark, DE 19711.</p>
<p><a href="index.html">Baseball statistic calculators</a></p>
<script type="text/javascript" src="runsperinning.js"></script>
<!--#include virtual="/endOfBody.html"-->
</div>
</body>
</html>