Suppose 2 teams A and B are playing a series of games and the first team to win 4 games wins the series. Suppose that team A has a 55% chance of winning each game and that the outcome of each game is independent.
(a) What is the probability that team A wins the series? Give an exact result and confirm it via simulation.
(b) What is the expected number of games played? Give an exact result and confirm it via simulation.
(c) What is the expected number of games played given that team A wins the series? Give an exact result and confirm it via simulation.
(d) Now suppose we only know that team A is more likely to win each game, but do not know the exact probability. If the most likely number of games played is 5, what does this imply about the probability that team A wins each game?
This is what I have done but not getting it..need some input. Thank you
import numpy as np probs = np.array([.55 ,.45]) nsims = 500000 chance = np.random.uniform(size=(nsims, 7)) teamAWins = (chance > probs[None, :]).astype('i4') teamBWins = 1 - teamAWins teamAwincount = {} teamBwincount = {} for ngames in range(4, 8): afilt = teamAWins[:, :ngames].sum(axis=1) == 4 bfilt = teamBWins[:, :ngames].sum(axis=1) == 4 teamAwincount[ngames] = afilt.sum() teamBwincount[ngames] = bfilt.sum() teamAWins = teamAWins[~afilt] teamBWins = teamBWins[~bfilt] teamAwinprops = {k : 1. * count/nsims for k, count in teamAwincount.iteritems()} teamBwinprops = {k : 1. * count/nsims for k, count in teamBwincount.iteritems()}
np.random.uniform(size=(nsims, 7))to begin with...