Hello,
Want to have the probability that the A team wins all its matches with the simulation of monte carlo with f A = 0.4, f B = 0.3, f C = 0.2, f D = 0.1, help please.
Script below :
install.packages("gtools")
library("gtools")
alpha =c(.4,.3,.2,.1)
f = rdirichlet(1,alpha)
fA = f[, 1]
fB = f[, 2]
fC = f[, 3]
fD = f[, 4]
num= (fA^3*fB^2*fC)
den= (fA+fB)*(fA+fC)*(fA+fD)*(fB+fC)*(fB+fD)*(fC+fD)
L = num / den
prior = 1
post = prior * L
post = post/sum(post)
sum((fA>fD) * post) # Probabilité A>D
sum((fA>fB) * post) # Probabilité A>B
sum((fA>fC) * post) # Probabilité A>C
sum((fB>fA) * post)
sum((fB>fC) * post)
sum((fB>fD) * post)
sum((fC>fA) * post)
sum((fC>fB) * post)
sum((fC>fD) * post)
sum((fD>fA) * post)
sum((fD>fB) * post)
sum((fD>fC) * post)