I have this problem where there are two teams: a and b. They play a series of 5 games that are each independent of the other. The winner of each game is given a certain number of points. Whichever team has the most points at the end wins the series. Each game is played and there are no ties, either a or b wins. I am given the chances for each team to win for each game and the number of points each game is worth.
DATA
GAME A B PTS
1 33.5 65.8 1
2 76.2 23.0 2
3 46.8 53.2 3
4 12.2 75.4 4
5 65.3 8.40 5
I am trying to simulate a winner for each game, then based on who wins add up their scores for each game to give a winner of the series. This would be simulated for 100 5-game series. The part I am not sure about is how to simulate a winner for an individual game based on their chance of winning. I found this link on stat.exchange about simulating head to data. This post pointed to using BradleyTerry2 R package. I read through the article and example 3.3 looks similar to what I am trying to do though I am not really sure how to implement it or how it predicts a winner. If this is not the approach to take I am open for pointers.
Here is my code so far
install.packages("BradleyTerry2")
library("BradleyTerry2")
a <- c(33.5,76.2,46.8,12.2,65.3)
b <- c(65.8,23,53.2,75.4,8.4)
pts <- c(1,2,3,4,5)
# simulate 100 5-game series
for (x in 1:100)
{
a_pts <- 0
b_pts <- 0
# loop through each game to predict winner
for (g in 1:5)
{
# predict winner of game
# this is where i need help
# give winning team pts
if(a[g]==1)
{
a_pts <- a_pts + pts[g]
}
if(b[g]==1)
{
b_pts <- b_pts + pts[g]
}
}
# tally up series won by a
if(a_pts > b_pts)
{
a_games[x] <- 1
}
if(a_pts < b_pts)
{
a_games[x] <- 0
}
}
# probability of a winning series
sum(a_games==1)/100
At this point I am just trying to figure out how to simulate the winner of an individual game based on their chance of winning. I will fix the checks to add points to the winner based on code/variables for predicting a winner. I am fairly new to both stats and R so any suggestions for generating a simulation either in R (preferable) or using statics equations I am open to hear.