d_raw <- read_csv(
"data/shots_dataset_cleaned.csv",
show_col_types = FALSE
)
raw_rows <- nrow(d_raw)
raw_cols <- ncol(d_raw)
The dataset is called Football Shots Dataset: Top 5 European
Leagues. I obtained shots_dataset_cleaned.csv from the
Kaggle
dataset page, where it was posted by Mat 126. The page did not list
a version number when I downloaded the file on September 20, 2026.
The Kaggle page does not clearly identify the original collector of the full dataset or exactly how all of the observations were obtained. It describes the data as suitable for statistical analysis, goal-prediction models, tactical research, and player scouting.
The rows describe observed shot events from football matches. The Kaggle description identifies the Premier League, La Liga, Serie A, Bundesliga, and Ligue 1 as the leagues of interest and states that the data cover the 2014/15 through 2020/21 seasons. One row represents one shot event taken by a player in a match.
The Kaggle page lists the dataset under the Open Database License, with the contents covered by the Database Contents License. This permits reuse subject to the conditions of the Open Data Commons licences.
The original file has 442,592 rows and 23 columns. After restricting the data to the five documented leagues, the model uses 393,374 shot rows. This report uses the four model variables below, together with identifiers used for the independence and influence checks.
Missing values are represented by empty cells in the CSV file. After
restricting the analysis to the five documented leagues, none of the
four model variables used here (X, header,
minute, and situation) is missing, so no
additional model rows are removed for missing data.
The file contains rows labeled Russian PL even though
the dataset is presented as the top five European leagues, so those rows
are excluded before the model is fitted. The documentation also does not
fully describe the original collection process, and its stated season
coverage does not perfectly match every date in the CSV. These
limitations make the file useful for this association analysis but leave
some uncertainty about its provenance and coverage.
The report restricts the file to the five leagues named in the documentation, creates a binary indicator for headed shots, and stores shot situation as a factor with OpenPlay as the reference group. These changes are shown in Section 4.
Mat 126. (n.d.). Football Shots Dataset: Top 5 European Leagues. Kaggle. https://www.kaggle.com/datasets/mat126/shots-dataset-for-footballsoccer. Accessed September 20, 2026.
Headers are usually attempted from a different set of locations than shots taken with the feet or another body part. Shot location may also vary with the time of the match and with the situation that produced the attempt, so comparing headers with other shots while holding those features fixed gives a more focused description of where headers occur.
Research question: Among shots in the top five
European leagues, is shot location toward the goal line (X,
normalized from 0 to 1) different for headed versus non-headed shots,
when match minute and shot situation are held fixed?
\(H_0\): The true coefficient for
header is 0 when match minute and shot situation are
included in the model.
\(H_A\): The true coefficient for
header is not 0. I expect the coefficient to be positive
because headed shots are generally taken closer to the goal line than
non-headed shots.
X is the outcome, stored as
dbl. It is the normalized horizontal shot location toward
the goal line, where larger values are closer to the goal line. In the
model data it ranges from 0.219 to 0.999, with mean 0.846 and standard
deviation 0.079.header is the predictor of interest, a
binary categorical indicator stored numerically: 1 for a headed shot and
0 for a non-headed shot. The model data contain 69,512 headed shots and
323,862 non-headed shots.minute is another predictor, stored as
dbl, measuring match time in minutes. It ranges from 0 to
105, with mean 48.49 and standard deviation 26.6 minutes.situation is another predictor, stored
as a factor. OpenPlay is the reference group. The other levels are
FromCorner, SetPiece, DirectFreekick, and Penalty. Their model-data
counts are shown below.| Shot situation | Number of shots |
|---|---|
| OpenPlay | 282,679 |
| FromCorner | 60,688 |
| SetPiece | 26,639 |
| DirectFreekick | 17,856 |
| Penalty | 5,512 |
top_five <- c("Premier League", "Liga", "Serie A", "Bundesliga", "Ligue 1")
d <- d_raw |>
filter(lega %in% top_five) |>
mutate(
header = if_else(shotType == "Head", 1, 0),
situation = relevel(factor(situation), ref = "OpenPlay")
)
model_data <- d |>
select(id, match_id, player_id, X, header, minute, situation) |>
drop_na(X, header, minute, situation)
Restricting the file to the five documented leagues removes 49,218
rows labeled Russian PL. I created header from
shotType, coded 1 for Head and 0 for every other shot type,
and set OpenPlay as the reference group for situation.
Because header has two groups, I use the 0/1 coding allowed
in Lab 7, with non-header (0) as the baseline group. The resulting model
table contains 393,374 rows, and no additional rows are lost to missing
values in the model variables. Every model below is fitted to these same
rows unless a sensitivity analysis explicitly says otherwise.
ggplot(model_data, aes(x = X)) +
geom_histogram(binwidth = 0.01, boundary = 0) +
labs(x = "Horizontal shot location toward goal line, X (0 to 1)",
y = "Number of shots") +
theme_minimal()
Distribution of horizontal shot location X in the model data.
header_labels <- c(
"0" = paste0("Non-header\n(n = ", format(header_counts$n[header_counts$header == 0], big.mark = ","), ")"),
"1" = paste0("Header\n(n = ", format(header_counts$n[header_counts$header == 1], big.mark = ","), ")")
)
ggplot(model_data, aes(x = factor(header), y = X)) +
geom_boxplot(outlier.shape = NA) +
scale_x_discrete(labels = header_labels) +
labs(x = "Shot type",
y = "Horizontal shot location toward goal line, X (0 to 1)") +
theme_minimal()
ggplot(explore_sample, aes(x = minute, y = X)) +
geom_point(alpha = 0.10, size = 0.5) +
geom_smooth(method = "lm", se = FALSE) +
labs(x = "Match minute (minutes)",
y = "Horizontal shot location toward goal line, X (0 to 1)") +
theme_minimal()
Shot location X against match minute. A random sample of 20,000 shots is shown so the point cloud remains readable.
situation_label_values <- setNames(
paste0(as.character(situation_counts$situation),
"\n(n = ", format(situation_counts$n, big.mark = ","), ")"),
as.character(situation_counts$situation)
)
ggplot(model_data, aes(x = situation, y = X)) +
geom_boxplot(outlier.shape = NA) +
scale_x_discrete(labels = situation_label_values) +
labs(x = "Shot situation",
y = "Horizontal shot location toward goal line, X (0 to 1)") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 30, hjust = 1))
| X | header | minute | |
|---|---|---|---|
| X | 1.00 | 0.4 | 0.02 |
| header | 0.40 | 1.0 | 0.00 |
| minute | 0.02 | 0.0 | 1.00 |
The outcome is concentrated toward the goal-line end of its observed
range. Headed shots are visibly closer to the goal line than non-headed
shots: their mean X is 0.915, compared with 0.831 for
non-headed shots. Match minute has only a weak marginal relationship
with X (0.021), while the point-biserial correlation
between header and X is 0.401. The situation
boxplots also differ substantially, especially for DirectFreekick and
Penalty. The numeric predictors themselves are essentially unrelated
(0.001), so the exploratory analysis does not suggest serious overlap
between them. A small number of shots have unusually low X values
compared with the main concentration of the data, so those observations
are worth checking for influence. The plots suggest that unequal spread
across groups may matter more than curvature, which is checked formally
below.
first_model <- lm(X ~ header + minute + situation, data = model_data)
first_summary <- summary(first_model)
first_f <- first_summary$fstatistic
first_f_p <- pf(first_f[1], first_f[2], first_f[3], lower.tail = FALSE)
The model includes header because it is the predictor of
interest. minute is included because shot selection and
location may change over the course of a match. situation
is included because different situations constrain where shots are taken
and are also related to whether a shot is a header.
The first model has \(R^2\) = 0.21
and adjusted \(R^2\) = 0.21. Its
whole-model test is \(F\)(6, 393367) =
1.74251^{4}, \(p\) <2e-16. The null
hypothesis for this test is that every slope in the model is 0. Every
displayed slope coefficient - header, minute,
and each contrast for situation - has a \(p\) value below 0.05. The coefficients are
interpreted only after the checks and remediation.
ggplot(diag_sample, aes(x = predicted, y = residual)) +
geom_point(alpha = 0.12, size = 0.4) +
geom_hline(yintercept = 0) +
labs(x = "Predicted shot location X (0 to 1)",
y = "Residual in shot location X") +
theme_minimal()
The residuals do not show a clear smooth curve around zero. The
fitted values form visible bands because header and
situation are categorical, but the main pattern is a change
in spread rather than a curved mean. I therefore treat linearity as
reasonably met.
Each row is one shot event, but players contribute repeated shots and each match contains several shots. The observations are therefore grouped rather than strictly independent. There are 13,484 matches and 5,220 players in the model data.
set.seed(3100)
sample_matches <- sample(unique(model_data$match_id),
min(30, n_distinct(model_data$match_id)))
model_data |>
filter(match_id %in% sample_matches) |>
mutate(match_id = factor(match_id)) |>
ggplot(aes(x = residual, y = reorder(match_id, residual, median))) +
geom_boxplot() +
geom_vline(xintercept = 0) +
labs(x = "Residual in shot location X",
y = "Match ID (sample of 30 matches)") +
theme_minimal()
For the Durbin-Watson test, I sorted rows by match_id
and then by minute within match so that shots from the same
match are neighbors. The test gives DW = 1.6 with \(p\) <2e-16. Its null hypothesis is no
positive first-order autocorrelation between neighboring residuals. The
small \(p\) value, together with the
repeated shots within matches and players, indicates that independence
is not fully met. Residual clustering can make ordinary standard errors
too small.
The residual plot above shows noticeably different spreads across fitted-value bands, so the spread is not constant.
The Breusch-Pagan test gives BP = 2.217439^{4} on 6 degrees of freedom, with \(p\) <2e-16. Its null hypothesis is constant residual variance. The small \(p\) value and the plot indicate that equal variance is not met, so ordinary standard errors can be too large or too small.
ggplot(diag_sample, aes(sample = residual)) +
stat_qq(alpha = 0.25, size = 0.6) +
stat_qq_line() +
labs(x = "Theoretical normal quantiles",
y = "Residual quantiles") +
theme_minimal()
The Q-Q plot departs from the reference line in the tails, especially in the lower tail, so normality is not fully met. Shapiro-Wilk cannot be run on all 393,374 residuals because R accepts at most 5,000 values, so there is no valid full-data \(W\) statistic or \(p\) value to report. Its null hypothesis would be that the residuals are normally distributed. With nearly four hundred thousand rows, this departure is less important for the accuracy of the regression \(p\) values than it would be in a small sample.
knitr::kable(vif_table, digits = 3)
| Predictor | GVIF | Df | GVIF^(1/(2*Df)) | Comparable_VIF | SE_multiplier |
|---|---|---|---|---|---|
| header | 1.231 | 1 | 1.109 | 1.231 | 1.109 |
| minute | 1.001 | 1 | 1.000 | 1.001 | 1.000 |
| situation | 1.232 | 4 | 1.026 | 1.054 | 1.026 |
The by-hand VIF for header is 1.231. The comparable VIF
values are about 1.23 for header, 1.00 for
minute, and 1.05 for situation, corresponding
to standard-error multipliers of only about 1.11, 1.00, and 1.03. None
is close to the usual rules of thumb of 5 or 10, so predictor overlap is
not a concern.
There are 10,919 observations above the Cook’s-distance rule, 10,919
beyond the DFFITS rule, and 13,110 beyond the DFBETAS rule for
header. A total of 6,217 observations cross all three.
Because the cutoffs become very small in such a large dataset, many real
shots are flagged; their values are within the observed coding rather
than being obvious errors or missing-value codes. The first ten are
shown only to identify examples without printing thousands of rows.
| id | match_id | X | header | minute | situation | cook | dffits_value | dfbetas_interest |
|---|---|---|---|---|---|---|---|---|
| 55057 | 209 | 0.682 | 0 | 7 | SetPiece | 0 | -0.0151 | 0.0044 |
| 58857 | 156 | 0.710 | 0 | 79 | FromCorner | 0 | -0.0098 | 0.0045 |
| 133834 | 3841 | 0.967 | 0 | 27 | FromCorner | 0 | 0.0084 | -0.0040 |
| 194186 | 7364 | 0.983 | 0 | 83 | SetPiece | 0 | 0.0137 | -0.0041 |
| 414960 | 15070 | 0.703 | 0 | 80 | FromCorner | 0 | -0.0104 | 0.0048 |
| 414960 | 15070 | 0.703 | 0 | 80 | FromCorner | 0 | -0.0104 | 0.0048 |
| 414960 | 15070 | 0.703 | 0 | 80 | FromCorner | 0 | -0.0104 | 0.0048 |
| 414960 | 15070 | 0.703 | 0 | 80 | FromCorner | 0 | -0.0104 | 0.0048 |
| 159404 | 7200 | 0.962 | 0 | 15 | SetPiece | 0 | 0.0121 | -0.0036 |
| 159404 | 7200 | 0.962 | 0 | 15 | SetPiece | 0 | 0.0121 | -0.0036 |
Overall, linearity is reasonably met. Independence is not fully met, equal variance is not met, and normality is imperfect in the tails. Predictor overlap is small, while the influence rules flag many real observations that require a sensitivity comparison rather than automatic deletion.
HC3 leaves the fitted coefficients and \(R^2\) unchanged but recomputes their
uncertainty. The header estimate therefore remains 0.0754.
Its ordinary standard error is 3.27^{-4}, while its HC3 standard error
is 2.26^{-4}. The \(p\) value remains
<2e-16. The sign, size, and inferential conclusion for the predictor
of interest therefore do not depend on the unequal-variance correction.
HC3 addresses the unequal spread in the standard errors; it does not
make the residual spread equal.
A direct fixed-effect remedy would require adding a categorical
variable for 13,484 matches or 5,220 players to an ordinary
lm() model. That would add thousands of group levels and is
not a practical model for this report. I therefore keep the stated
additive model and treat the remaining within-match and within-player
dependence as a limitation. Importantly, HC3 corrects unequal variance
but does not correct this grouping dependence.
I did not transform X solely to make the residual tails
more normal. The outcome is already on a bounded and directly
interpretable 0-1 location scale, linearity is reasonably met, and with
this very large sample the tail departure has limited effect on slope
inference. Normality is therefore retained as a stated limitation rather
than used as a reason to replace the model.
Leaving out the 6,217 observations that crossed all three influence
rules changes the header coefficient from 0.0754 to 0.0759.
Its sign stays positive and its \(p\)
value remains <2e-16. \(R^2\)
changes from 0.21 to 0.221. The estimated header difference is therefore
very similar after the flagged observations are removed. Because the
flagged rows are real observations rather than obvious errors, and
because removing them does not change the substantive answer, I keep
them in the final analysis.
Hover over the two bars to compare the estimated header coefficient before and after excluding the observations flagged by all three influence rules. The estimates remain positive and very similar, supporting the decision to retain the flagged observations.
These comparisons support keeping the original additive model. The final fit uses all model rows, with HC3 standard errors for inference about the coefficients.
final_model <- lm(X ~ header + minute + situation, data = model_data)
final_summary <- summary(final_model)
final_f <- final_summary$fstatistic
final_f_p <- pf(final_f[1], final_f[2], final_f[3], lower.tail = FALSE)
final_hc3 <- coeftest(
final_model,
vcov = vcovHC(final_model, type = "HC3")
)
final_table <- as.data.frame(coef(summary(final_model)))
final_table$Term <- c(
"Intercept",
"Header (vs. non-header)",
"Match minute",
"Direct free kick (vs. OpenPlay)",
"From corner (vs. OpenPlay)",
"Penalty (vs. OpenPlay)",
"Set piece (vs. OpenPlay)"
)
final_table <- final_table |>
select(
Term,
Estimate,
`Std. Error`,
`t value`,
`Pr(>|t|)`
)
knitr::kable(
final_table,
digits = 4,
col.names = c("Term", "Estimate", "Std. error", "t", "p")
)
| Term | Estimate | Std. error | t | p | |
|---|---|---|---|---|---|
| (Intercept) | Intercept | 0.8303 | 2e-04 | 3377.0108 | 0 |
| header | Header (vs. non-header) | 0.0754 | 3e-04 | 230.4297 | 0 |
| minute | Match minute | 0.0001 | 0e+00 | 15.3777 | 0 |
| situationDirectFreekick | Direct free kick (vs. OpenPlay) | -0.0754 | 5e-04 | -138.2923 | 0 |
| situationFromCorner | From corner (vs. OpenPlay) | 0.0119 | 3e-04 | 34.7260 | 0 |
| situationPenalty | Penalty (vs. OpenPlay) | 0.0513 | 1e-03 | 53.4068 | 0 |
| situationSetPiece | Set piece (vs. OpenPlay) | 0.0050 | 5e-04 | 10.6548 | 0 |
The table reports the ordinary least-squares coefficient estimates and standard errors. Because equal variance is not met, the hypothesis test for the predictor of interest below uses HC3 robust standard errors.
The final model has \(R^2\) = 0.21,
adjusted \(R^2\) = 0.21, and residual
standard error 0.0705 on the 0-1 X scale. Its whole-model
test is \(F\)(6, 393367) = 1.74251^{4},
\(p\) <2e-16.
The coefficients have the following interpretations, with the other predictors held fixed:
X for a
non-headed OpenPlay shot at minute 0. This combination lies inside the
observed data; there are 1425 such shots.X value 0.075
higher than a non-headed shot at the same match minute and in the same
shot situation. On this scale, that means headed shots are typically
taken closer to the goal line.X, holding header status and shot
situation fixed. This minute-by-minute change is very small.X
about 0.075 lower.X about 0.012 higher, holding the other predictors
fixed.X about 0.051 higher, holding the other predictors
fixed.X about 0.005 higher, holding the other predictors
fixed.At a representative match minute of 49 and for OpenPlay shots, the
fitted model predicts X = 0.833 for a non-headed shot and
X = 0.909 for a headed shot.
Use the match-minute slider to compare predicted shot location for
headed and non-headed OpenPlay shots. Hover over either bar to read its
predicted X. Both predictions use the same minute and shot
situation, so their difference isolates the fitted header
coefficient. The predictions are calculated from the final model above,
not from a new model.
At any selected minute, the difference between the two predictions is 0.0754 on the normalized location scale. This is the positive adjusted header difference reported above. The graph presents model predictions rather than a causal effect.
The HC3 test for header gives \(t\) = 333.52 and \(p\) <2e-16. Under \(H_0\), this \(p\) value is the probability of obtaining a
coefficient test statistic at least this far from 0 if the true
header coefficient were 0 with match minute and shot
situation in the model. The probability is extremely small, so I reject
\(H_0\) and find evidence that headed
and non-headed shots differ in X after those predictors are
held fixed.
header addsfinal_without_header <- lm(X ~ minute + situation, data = model_data)
final_delta_r2 <- final_summary$r.squared - summary(final_without_header)$r.squared
final_compare <- anova(final_without_header, final_model)
Without header, the model has \(R^2\) = 0.103; with it, \(R^2\) = 0.21. Thus, adding
header increases \(R^2\)
by 0.107, meaning that header status accounts for about 10.7 additional
percentage points of variation in X beyond match minute and
shot situation. The nested-model comparison gives \(F\)(1, 393367) = 5.309784^{4}, \(p\) <2e-16, which leads to the same
conclusion about the null hypothesis.
Linearity remains reasonably met. Independence is not fully met because shots are repeated within matches and players, so even the HC3 inference should be interpreted with that limitation in mind. Equal variance is not met, but HC3 standard errors are used so coefficient inference does not rely on constant residual variance. Normality is imperfect in the tails, although the very large sample reduces its effect on slope inference.
Summary. Among shots in the top five European
leagues, headed shots are located about 0.075 higher on the normalized
X scale than non-headed shots when match minute and shot
situation are held fixed. The HC3 test gives \(p\) <2e-16, so I reject the null
hypothesis that the adjusted header difference is 0. Header status also
adds about 10.7 percentage points to \(R^2\) beyond minute and situation.
Implications. The result describes a substantial and consistent location difference in these observed shot data: headers tend to occur closer to the goal line even after broad shot situation and match timing are taken into account. For analysts comparing shot profiles, header frequency therefore carries information about where a team’s or player’s attempts are being taken, rather than simply recording another shot label.
Limitations. This is an association, not a causal effect; the model cannot show that changing a non-headed shot into a header would itself move the shot location. The observations are also not fully independent because the same matches and players contribute multiple shots, and HC3 addresses unequal variance rather than that grouping. A specific variable not in the model is player position (for example, forward, midfielder, or defender). Player position could be related both to how often a player attempts headers and to the locations from which that player shoots, so some of the estimated header difference could reflect role differences. The dataset also covers only the leagues and seasons represented in this file and has limited documentation of its original collection process.
Future direction. A follow-up analysis could merge a
player-position variable into the shot data and refit the same model
with position held fixed, then compare the header
coefficient with the estimate in this report. A further extension could
use a model designed for repeated observations within matches or players
to determine whether explicitly accounting for that grouping changes the
uncertainty around the header effect.
I used ChatGPT to help interpret the Report 2 brief, organize results from Labs 6-9, check and verify regression and remediation logic, and revise the wording of the report.
For this web version, I used ChatGPT to adapt the R Markdown output to HTML and help write the Plotly interactive prediction and sensitivity-comparison figures.