**Question:** The opponents of soccer team A are of two types: either they are a class 1 or a class 2 team. The number of goals team A scores against a class-i opponent is a Poisson random variable with mean λ_{i}, where λ_{1} = 2, λ_{2} = 3. This weekend the team has two games against teams they are not very familiar with. Assuming that the first team they play is a class 1 team with probability 0.6 and the second is, independently of the class of the first team, a class 1 team with probability 0.3, determine the following

- expected number of goals team A will score this weekend.
- the probability that team A will score a total of five goals.

**Analytical Solution**

- E[ X ] = E[X
_{w/Team 1}+X_{w/Team 2}] = E[X_{w/Team 1}] + E[X_{w/Team 2}]- ⇒ E[ X ] = ∑ E[X
_{w/Team 1}| class = i ] P{ class=i } + ∑ E[X_{w/Team 2}| class = i ] P{ class=i } - ⇒ E[ X ] = (2*0.6 + 3*0.4) + (2*0.3 + 3*0.7) = 5.1

- ⇒ E[ X ] = ∑ E[X
- Part 2 can be observed from the simulation below

**Simulation Solution**

The simulation pretty much explains the distribution of the outcomes upon multiple iterations. This chart shows the simulation of about 10000 games.

**Code**

Module[{teams = {{0.6, 0.4} -> {2, 3}, {0.3, 0.7} -> {2, 3}}, goals, games, outcomes, barChart, distributionChart, iterations = Power[10, 4]}, goals := Plus @@ (RandomVariate[PoissonDistribution[RandomChoice[#]]] & /@ teams); outcomes = Table[goals, iterations]; games = KeySort[Counts[outcomes]]; barChart = BarChart[games, ImageSize -> 788, Frame -> {{True, True}, {False, True}}, FrameTicks -> {Range@Max@Keys@games, Automatic}, ChartLabels -> Placed[{N[Values@games / iterations], Values@games}, {Above, Below}], AspectRatio -> 0.5, ChartStyle -> LightBlue, PlotLabel -> Style["Distribution of the outcomes", Black, 13]]; distributionChart = DistributionChart[{{outcomes, Mean /@ Partition[outcomes, 10]}}, ImageSize -> 788, ChartElementFunction -> "PointDensity", ChartLegends -> Placed[{"Actual Outcomes", "Batched Means (Batch size = 10)"}, Below], AspectRatio -> 0.5, PlotLabel -> Style["Distribution Chart of the outcomes and the batch means", 13, Black]]; Column[{barChart, "\n\n", distributionChart}] ]

End of the post 😉

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.