3 views

Uploaded by ZhichaoWang

f

f

© All Rights Reserved

- 262585680 Abe Cofnas Sentiment Indicators Renko Price Break Kagi Point and Figure 2010 292 Pages.85
- 262585680 Abe Cofnas Sentiment Indicators Renko Price Break Kagi Point and Figure 2010 292 Pages.1
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..131
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..166
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..121
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..127
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..233
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..200
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..257
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..312
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..11
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..302
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..189
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..149
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..58
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..270
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..310
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..311
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..315
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..181

You are on page 1of 1

"""Assumes numGames an odd integer,

teamProb a float between 0 and 1

Returns True if better team wins series"""

numWon = 0

for game in range(numGames):

if random.random() <= teamProb:

numWon += 1

return (numWon > numGames//2)

def simSeries(numSeries):

prob = 0.5

fracWon = []

probs = []

while prob <= 1.0:

seriesWon = 0.0

for i in range(numSeries):

if playSeries(7, prob):

seriesWon += 1

fracWon.append(seriesWon/numSeries)

probs.append(prob)

prob += 0.01

pylab.plot(probs, fracWon, linewidth = 5)

pylab.xlabel('Probability of Winning a Game')

pylab.ylabel('Probability of Winning a Series')

pylab.axhline(0.95)

pylab.ylim(0.5, 1.1)

pylab.title(str(numSeries) + ' Seven-Game Series')

simSeries(400)

When simSeries is used to simulate 400

seven-game series, it produces the plot

on the right. Notice that for the better

team to win 95% of the time (0.95 on the

y-axis), it needs to be more than three

times better than its opponent. That is

to say, the better team needs to win, on

average, more than three out of four

games (0.75 on the x-axis). For

comparison, in 2009, the two teams in

the World Series had regular season

winning percentages of 63.6% (New York

Yankees) and 57.4% (Philadelphia Phillies). This suggests that New York should

win about 52.5% of the games between the two teams. Our plot tells us that

even if they were to play each other in 400 seven-game series, the Yankees would

win less than 60% of the time.

Suppose we assume that these winning percentages are accurate reflections of

the relative strengths of these two teams. How many games long should the

175

- 262585680 Abe Cofnas Sentiment Indicators Renko Price Break Kagi Point and Figure 2010 292 Pages.85Uploaded byZhichaoWang
- 262585680 Abe Cofnas Sentiment Indicators Renko Price Break Kagi Point and Figure 2010 292 Pages.1Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..131Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..166Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..121Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..127Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..233Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..200Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..257Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..312Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..11Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..302Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..189Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..149Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..58Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..270Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..310Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..311Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..315Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..181Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..162Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..123Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..223Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..293Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..160Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..126Uploaded byZhichaoWang