Setup

figsize[inches_] := inches(468/3.125);

Input data for English Premier League 2018-2019

rawdata = 
Import["/Users/dmeyer/Teaching/180Awinter20/Lecture15/Premier201819.xlsx"];
rawdata = Flatten[rawdata]

Organize data

goals = {};
Do[
string = rawdata[[i]];
If[StringLength[string] == 3,
AppendTo[
goals,
ToExpression[StringTake[string,1]]+ToExpression[StringTake[string,-1]]
]
],
{i,1,Length[rawdata]}
];
goals

Analyze data

max = Max[goals];
Print[Style["maximum # goals = ",Red,18],Style[max,Red,18]];
λ = Mean[goals];
Print[Style["average # goals = ",Red,18],Style[N[λ],Red,18]];
data = Sort[Tally[goals]];
freq = Table[{data[[i,1]],data[[i,2]]/Length[goals]},{i,1,Length[data]}];
dataplot =
ListPlot[
freq,
PlotStyle->Directive[Big,Red],
AxesStyle->Directive[Thick,Black],
Ticks->{{1,2,3,4,5,6,7,8},Automatic},
BaseStyle->{FontSize->18},
AxesOrigin->{0,0},
AxesLabel->{"# goals","prob"},
PlotLabel->"Premier League goals, 2018-2019",
ImageSize->figsize[5]
];
model = Table[{k,E^(-λ) λ^k/k!},{k,0,max}];
modelplot =
ListPlot[
model,
PlotStyle->Directive[Big,Blue],
AxesStyle->Directive[Thick,Black],
Ticks->{{1,2,3,4,5,6,7,8},Automatic},
BaseStyle->{FontSize->18},
AxesOrigin->{0,0},
AxesLabel->{"# goals","prob"},
PlotLabel->"Premier League goals, 2018-2019",
ImageSize->figsize[5]
];
label =
Graphics[
{Text[Style["data; mean = 2.82105",Red,18],{5,0.22},{-1,0}],
Text[Style["fit:  Poisson(2.82105)",Blue,18],{5,0.2},{-1,0}]
}
];
Show[
dataplot,modelplot,label
]

(* World Cup 2018 *)

goals = 
{5,1,1,6,3,2,1,2,1,1,2,1,3,3,3,3,
4,1,1,1,2,1,3,2,2,3,7,3,3,7,4,3,
3,3,2,4,2,0,3,3,3,2,4,2,1,1,1,3,
7,3,2,2,2,5,1,2,2,3,2,4,1,3,2,6
};

Total[goals]
lambda = Mean[goals]
data = Sort[Tally[goals]]
dataplot =
ListPlot[
data,
PlotStyle->Directive[Big,Red]
];
model = Table[{k,Length[goals]*E^(-lambda) lambda^k/k!},{k,0,7}];
N[Total[model]]
modelplot =
ListPlot[
model,
PlotStyle->Directive[Big,Blue]
];

Show[
dataplot,modelplot,
PlotRange->All
]

(* UEFA Championship 2016 *)

goals = 
{3,1,2,2,1,0,
3,2,3,3,3,0,
1,2,2,0,1,1,
1,1,4,3,2,3,
2,2,1,3,1,1,
2,2,2,0,3,6,
2,1,1,3,3,4,
2,3,2,4,2,7,2,2,1
};

Total[goals]
lambda = Mean[goals]
data = Sort[Tally[goals]]
dataplot =
ListPlot[
data,
PlotStyle->Directive[Big,Red]
];
model = Table[{k,Length[goals]*E^(-lambda) lambda^k/k!},{k,0,7}];
N[Total[model]]
modelplot =
ListPlot[
model,
PlotStyle->Directive[Big,Blue]
];

Show[
dataplot,modelplot,
PlotRange->All
]