NBADivisonSimulation

Tim

08/03/2020

Introduction

How it works

Explaining the code

-Inputted probabilites are stored in a vector as such:

#Each element in the vector represents the probability of boston winning that particular game
boston <- c(.34,.55,.7,.4,.2,.8,.4,.3,.6,.5)
#We then use these probalities to generate random binomials for each game as follows:
bostonresults <- rbinom(length(boston),1, boston)
bostonresults
##  [1] 0 0 1 0 0 0 1 0 0 0
#Current number of wins for boston
bostoncurrent <- 42
#We sum up our predicted results and add them to the current number of wins
bostonfinal <- sum(bostonresults) + bostoncurrent
#Our final predicted number of wins:
bostonfinal
## [1] 44

The same process is repeated for Toronto. When Boston and Toronto play each other we generate a random binomial, add it to Bostons result and assign the inverse to Toronto.

Explaining the code continued

Thank You