Hypothesis: The home team that scores at least 4 goals will have a higher mean number of shots on target than the away teams that score at least 4 goals.
Null Hypothesis: The mean number of shots on target between the home and away teams that score at least 4 goals are similar.
First, the data set containing all the English Premier League results from the last 5 seasons (2021/22 - 2025/26) is loaded into R. To filter relevant data, columns containing home and away teams’ full time goals scored, total shots, and shots on target are chosen. Also, every match that contains either the home or away or both scoring at least 4 goals at full time. This helps analyze only the matches that are needed to prove the hypothesis.
# Load data set
getwd()
## [1] "/Users/cristiansanchez/Downloads/epl_scores"
setwd("/Users/cristiansanchez/Downloads/epl_scores")
pl_matches <- read.csv("combined_football_data.csv")
head(pl_matches)
## Date HomeTeam AwayTeam FTHG FTAG FTR HTHG HTAG HTR Referee HS
## 1 2021-08-13 Brentford Arsenal 2 0 H 1 0 H M Oliver 8
## 2 2021-08-14 Man United Leeds 5 1 H 1 0 H P Tierney 16
## 3 2021-08-14 Burnley Brighton 1 2 A 1 0 H D Coote 14
## 4 2021-08-14 Chelsea Crystal Palace 3 0 H 2 0 H J Moss 13
## 5 2021-08-14 Everton Southampton 3 1 H 0 1 A A Madley 14
## 6 2021-08-14 Leicester Wolves 1 0 H 1 0 H C Pawson 9
## AS HST AST HF AF HC AC HY AY HR AR
## 1 22 3 4 12 8 2 5 0 0 0 0
## 2 10 8 3 11 9 5 4 1 2 0 0
## 3 14 3 8 10 7 7 6 2 1 0 0
## 4 4 6 1 15 11 5 2 0 0 0 0
## 5 6 6 3 13 15 6 8 2 0 0 0
## 6 17 5 3 6 10 5 4 1 2 0 0
# Filter columns and add condition on FTHG and FTAG
filtered_pl_matches <- pl_matches[pl_matches$FTHG > 3 | pl_matches$FTAG > 3,
c("FTHG", "FTAG", "HS", "AS","HST", "AST")]
# Scatter Plot showing a home team's goals scored vs home team's shots on target
plot(filtered_pl_matches$FTHG,
filtered_pl_matches$HST,
xlab = "Home Team Goals Scored",
ylab = "Home Team Shots on Target",
main = "Home Team Goals vs Shots on Target",
col = "Red",
pch = 16,
cex = 0.8)
The scatter plot represent the home team’s goals scored and shots on target. Based on the resulting scatter plot, there’s a weak positive linear trend as the goals scored and shots on target increases. Therefore, the number of goals scored slightly influences the amount of shots on target for the home team.
The home team’s shots on target, regardless of the goals scored, are analyzed using the summary function.
# Display mean, median, min, max, 1st quarter, and 3rd quarter of shots on target for home team
summary(filtered_pl_matches$HST)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.000 4.000 6.000 6.365 8.000 16.000
Then, the shots on target is categorized by the goals scored by the home team.
# Average shots on target categorized by the amount of goals scored by home team
mean_home_shots <- aggregate(HST ~ FTHG,
data = filtered_pl_matches,
FUN = mean)
names(mean_home_shots) <- c("Home_Goals", "Mean_Home_Shots_on_Target")
mean_home_shots
## Home_Goals Mean_Home_Shots_on_Target
## 1 0 2.236842
## 2 1 3.974359
## 3 2 4.666667
## 4 3 5.166667
## 5 4 7.781818
## 6 5 8.351351
## 7 6 9.700000
## 8 7 11.250000
## 9 9 12.000000
# Visualization of average shots on target for every goal scored by the home team
plot(mean_home_shots$Home_Goals,
mean_home_shots$Mean_Home_Shots_on_Target,
type = "b", pch = 16, col = "red",
xlab = "Home Team Goals",
ylab = "Avg. Home Team Shots on Target",
main = "Avg. Home Team Shots on Target Based on Goals Scored")
Based on the scatter plot, the average shots on target a home team records increases as the goals scored for the home team increases. Unlike the previous scatter plot, this shows a stronger positive trend using the mean number of every goal scored. Based on the hypothesis, the home team that scores more than 3 goals shows a strong positive relationship to the shots on target. Remember, this scatter plot takes into account home team scoring less than 4 goals in which the away team scores 4 or more goals.
The goals scored by the home team and the shots on target are compared using the correlation test with the result visualized with the Linear Regression Model. Also, the away team’s goals scored and the shots on target are also tested.
# Correlation test for home team goals and home team shots on target
cor.test(filtered_pl_matches$FTHG, filtered_pl_matches$HST)
##
## Pearson's product-moment correlation
##
## data: filtered_pl_matches$FTHG and filtered_pl_matches$HST
## t = 17.425, df = 261, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.6719532 0.7846665
## sample estimates:
## cor
## 0.7333086
# Linear Regression Model between home team goals and home team shots on target
shots_goals_scored <- lm(formula = HST ~ FTHG, data = filtered_pl_matches)
plot(filtered_pl_matches$FTHG,
filtered_pl_matches$HST,
xlab = "Home Team Goals Scored",
ylab = "Home Team Shots on Target",
main = "Home Team Goals vs Shots on Target",
col = "Red",
pch = 16,
cex = 0.8)
abline(shots_goals_scored, col= "blue", lwd = 2)
# Correlation test for away team goals and away team shots on target
cor.test(filtered_pl_matches$FTAG, filtered_pl_matches$AST)
##
## Pearson's product-moment correlation
##
## data: filtered_pl_matches$FTAG and filtered_pl_matches$AST
## t = 21.813, df = 261, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.7561440 0.8426526
## sample estimates:
## cor
## 0.8036027
# Linear Regression Model between away team goals scored and away team shots on target
shots_goals_scored_away <- lm(formula = AST ~ FTAG, data = filtered_pl_matches)
plot(filtered_pl_matches$FTAG,
filtered_pl_matches$AST,
xlab = "Away Team Goals Scored",
ylab = "Away Team Shots on Target",
main = "Away Team Goals vs Shots on Target",
col = "Red",
pch = 16,
cex = 0.8)
abline(shots_goals_scored_away, col= "blue", lwd = 2)
After running both correlation tests and linear regression models for home and away goals and shots on target, the results were interesting. After running the correlation test for the away teams, the cor number (0.8036027) is higher than the cor number in the home team (0.7333086). This suggests that the shots on target for the away team correlates to the goals scored more than the home team when the number of goals increases. However, this doesn’t determine if the away team registers a higher shots on target since the hypothesis mentions the mean number based on the team scoring at least 4 goals.
To investigate the away shots on target, a histogram is created to show the frequency of the away teams’ shots on target in the data set.
# Histogram displaying the frequency of the away team shots on target
hist(filtered_pl_matches$AST,
breaks =15,
xlab= "Away Teams' Shots on Target",
ylab= "Frequency",
main= "Distribution of the Away Teams' Shots on Target",
col= "purple")
Based on the histogram, the distribution tends to be right-skewed based on the away teams’ shots on target. However, this doesn’t imply that the away team will have a lower mean number of shots on target compared to the home team. Therefore, comparing the two distributions for shots on target is important in determining whether the hypothesis or the null hypothesis is valid.
To test the hypothesis, a t-test is conducted between Home and Away teams’ shots on target. Since the hypothesis refers to teams that score at least 4 goals, a subcategory is created to only use data in matches where either the home team or away team, or both, scores 4 or more goals.
# T-test comparing the mean of shots on target for home and away teams
home_ST_four_goals <- subset(filtered_pl_matches, FTHG > 3)$HST
away_ST_four_goals <- subset(filtered_pl_matches, FTAG > 3)$AST
ST_four_goals_t_test <- t.test(away_ST_four_goals, home_ST_four_goals)
print(ST_four_goals_t_test)
##
## Welch Two Sample t-test
##
## data: away_ST_four_goals and home_ST_four_goals
## t = -0.89267, df = 231.46, p-value = 0.373
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.8789279 0.3308263
## sample estimates:
## mean of x mean of y
## 7.867925 8.141975
After running the t-test, the mean number of shots of target between home and away teams scoring more than 3 goals remain very similar. The mean number of home teams’ shots on target registered at 8.1419 while the away teams’ mean number registered at 7.8679. However, the p-value recorded after the t-test is 0.373. This suggests that there’s no statistical evidence that the home and away teams have a different average of shots on target when scoring more than 3 goals.
Conclusion: There is insufficient evidence to support the hypothesis that home teams scoring at least four goals have a higher mean number of shots on target than away teams scoring at least four goals. Although the earlier descriptive results suggested that away teams may have a higher mean, the independent-samples t-test found no statistically significant difference between the two groups. Since this data set takes into account all the teams in the Premier League, other factors would’ve impacted the analysis including team quality, goalkeeper performance, home advantage, opponent quality, and data limitations. For example, teams like Manchester City would register more shots on target while scoring more goals due to team tactics and quality while other teams rely more on defensive tactics and register a lower shots on target. Therefore, further analysis could examine individual teams or account for team tactics and opponent strength. These factors may influence the mean number of shots on target, rather than the difference being explained solely by whether a team is playing at home or away.