Live data from Hacker News

How I'm Predicting Baseball Outcomes

blog.zachschnell.com

11–20 of 45 posts

Re: How I'm Predicting Baseball Outcomes

#11
Hall of Fame manager Earl Weaver said: "Momentum? Momentum is the next day's starting pitcher."

Baseball fan in me says that is correct but statistician in me would like to see more models like yours to quantify it.

Re: How I'm Predicting Baseball Outcomes

#13
Rather than waiting for data from future games, you should backtest on old data and see how it performs (http://en.wikipedia.org/wiki/Backtesting).

You might also be interested in checking out the book The Signal and The Noise by Nate Silver (He runs the FiveThirtyEight political/data blog that notably predicted last year's election results with great accuracy.)

Re: How I'm Predicting Baseball Outcomes

#14
post #5

Isn't this an example of the gambler's fallacy, that previous outcomes impact future outcomes?

If game results were independent, yes. But lots of things in baseball aren't independent: teams play the same opponent repeatedly in short series, runs of home or away series occur, pitchers rotate, players get injured, teams may slack when overperforming or intensify their efforts to avoid extended losing streaks, etc.

Most of all: baseballers are fairly superstitious. They believe in streaks, lucky rituals, jinxes, and the gamblet's fallacy (being 'due' for a win or a loss). So some serial correlation could be a self-fulfilling prophesy.

Still, I'd expect tons of other available team stats to outperform the last N game results in predictive power.

Re: How I'm Predicting Baseball Outcomes

#15
post #13

Rather than waiting for data from future games, you should backtest on old data and see how it performs ( http://en.wikipedia.org/wiki/Backtesting ). You might also be interested in checking out the book The Signal and The Noise by Nate Silver (He runs the FiveThirtyEight political/data blog that notably predicted last year's election results with great accuracy.)

Excellent idea. And it will provide a much faster way to gauge its accuracy as I adjust the script to accomodate more areas of information.

I actually just started that book and so far so excellent.

Re: How I'm Predicting Baseball Outcomes

#16
post #12
post #7

What, this is just streak-based? Do streaks even exist in baseball?

yeah for now... They're most definitely a thing, though I have a documents worth of baseball elements I hope to incorporate

Are they?

    jerf@jerfhom:~$ python
    Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
    [GCC 4.7.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import random
    >>> 94.0/(94+68)
    0.5802469135802469
    >>> winp = 94.0/(94+68)
    >>> games = []
    >>> for x in range(50):
    ...     games.append('w' if random.random() >> ''.join(games)
    'wLwLwwwwwLwLwLwwwLLLwLwwLwLLLwwLwwwwwLwwwLwwLLwLLw'
In my full simulation of 162 games, the longest streak was a 7 game losing streak, despite the higher win percentage. Of course you'll get different results each run; my next run produced a 9 game winning streak, which some quick Googling suggests is in line with what happened in 2010.

Combine this with the fact that real play is not drawn uniformly (you may play a much worse team against which you have a much better win percentage for several games in a row) and I don't see much need for some sort of meaningful, statistically-predictive "streak" to explain game results.

Re: How I'm Predicting Baseball Outcomes

#17
post #16
post #12

Earlier quoted context omitted.

yeah for now... They're most definitely a thing, though I have a documents worth of baseball elements I hope to incorporate

Are they? jerf@jerfhom:~$ python Python 2.7.3 (default, Sep 26 2012, 21:51:14) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import random >>> 94.0/(94+68) 0.5802469135802469 >>> winp = 94.0/(94+68) >>> games = [] >>> for x in range(50): ... games.append('w' if random.random() >> ''.join(games) 'wLwLwwwwwLwLwLwwwLLLwLwwLwLLLwwLwwwwwLwwwLwwLLwLLw' In my full simulatio…

The 2012 data I used as the basis of my program actually had the same thing you describe – the longest streak was an 8 game losing streak despite having more wins than losses overall.

And I understand exactly where you're coming from. This is very preliminary, and if anything it was good coding practice for me. Though I very much intend to incorporate more significant factors like the lineup, the opposing team, and their history.

Re: How I'm Predicting Baseball Outcomes

#18
post #13

Rather than waiting for data from future games, you should backtest on old data and see how it performs ( http://en.wikipedia.org/wiki/Backtesting ). You might also be interested in checking out the book The Signal and The Noise by Nate Silver (He runs the FiveThirtyEight political/data blog that notably predicted last year's election results with great accuracy.)

More relevant--before he did statistical analysis of elections, he was a leading figure in sabermetrics, the statistical analysis of baseball. His program is still one of the best.

Re: How I'm Predicting Baseball Outcomes

#20
If you want a broader dataset, check out the data from Retrosheet (http://www.retrosheet.org/). You can get box scores and play-by-play data from many years back to dive really deep into stats. You can use Chadwick command-line tools (http://chadwick.sourceforge.net/) to parse the data into SportsML or other formats.
Post reply on HN