The Opening Goal Advantage
Abstract
This study examines the opening goal advantage using 3,703 matches drawn from
the Soccers football database. In 3,703 matches with goal timing, the opening
goal is worth a lot — but less than the cliché suggests. All computation runs in
Rust inside a .mars notebook (polars + plotters — charts as inline SVG), and
every table and figure is generated from the extracted CSVs.
Keywords
Keywords: football, analysis, comebacks, mars, sqlite
Table of contents
Introduction
Scoring first is football's oldest cliché — but how much is it actually worth? This notebook replays the goal timelines of 3,703 matches with timing data and measures what happens after the first goal: how often the first scorer wins, which teams are best at protecting an early lead, and which are best at recovering after conceding first.
We also split by when the first goal arrives (first half vs second half), since a 10th-minute opener and an 80th-minute opener are not the same thing.
Methods
Data were extracted from the Soccers football database (packages/data) as CSV
snapshots: goal_events.
The analysis runs entirely in Rust inside the notebook: polars handles table
scans, joins and aggregations; plotters renders figures as inline SVG;
mars_table renders result tables.
Each code cell is kept to a single output so results can be read top to bottom.
Results
All figures and tables below are computed directly from the extracted data. Each code cell produces one output — a table, a chart, or a short text summary.
use polars::prelude::*;
let df = LazyCsvReader::new("data/goal_events.csv")
.finish()
.expect("failed to open data/goal_events.csv — run from the notebook directory")
.collect()
.expect("failed to collect CSV into DataFrame");
println!(
"loaded {} goal rows | schema: {:?}",
df.height(),
df.get_column_names()
);
loaded 11328 goal rows | schema: ["mid", "minute", "added_minute", "player", "gtid", "gteam", "hid", "aid", "home", "away", "hg", "ag", "league", "date", "season"]
let s = |name: &str| df.column(name).unwrap_or_else(|_| panic!("missing {name}")).clone();
let col_str = |name: &str| -> Vec<String> {
s(name).str().unwrap().iter().map(|o| o.unwrap_or("").to_string()).collect()
};
let col_i64 = |name: &str| -> Vec<i64> {
let c = s(name);
let c = if c.dtype() == &DataType::Null { c.cast(&DataType::Int64).unwrap() } else { c };
c.i64().unwrap().iter().map(|o| o.unwrap_or(0)).collect()
};
let mid_v = col_i64("mid");
let league_v = col_str("league");
let hid_v = col_i64("hid");
let aid_v = col_i64("aid");
let home_v = col_str("home");
let away_v = col_str("away");
let hg_v = col_i64("hg");
let ag_v = col_i64("ag");
let minute_v = col_i64("minute");
let added_v = col_i64("added_minute");
let gtid_v = col_i64("gtid");
let gteam_v = col_str("gteam");
let ng = df.height();
println!("extracted {ng} goal rows");
// index goals by match, sorted by (minute, added)
use std::collections::BTreeMap;
let mut order: Vec<usize> = (0..ng).collect();
order.sort_by_key(|&i| (mid_v[i], minute_v[i], added_v[i]));
// per-match goal lists
let mut match_goals: BTreeMap<i64, Vec<usize>> = BTreeMap::new();
for &i in &order {
match_goals.entry(mid_v[i]).or_default().push(i);
}
// team display names
let mut names: std::collections::HashMap<i64, String> = std::collections::HashMap::new();
for i in 0..ng {
names.entry(hid_v[i]).or_insert_with(|| home_v[i].clone());
names.entry(aid_v[i]).or_insert_with(|| away_v[i].clone());
}
println!("matches with goal data: {}", match_goals.len());
extracted 11328 goal rows
matches with goal data: 3703
First-goal outcomes
For each match: the first goal's scorer "scored first"; the other side "conceded first". We record the final result for both, plus the minute of the opener.
use std::collections::HashMap;
#[derive(Default, Clone)]
struct FO {
scored_first: u64, won_after_first: u64,
conceded_first: u64, won_after_conceding: u64,
}
let mut fo: HashMap<i64, FO> = HashMap::new();
// first-goal minute buckets: (label range) -> [matches, first-scorer wins]
let mut fbuckets: HashMap<&'static str, (u64, u64)> = HashMap::new();
for (_mid, idxs) in match_goals.iter() {
let first = idxs[0];
let i0 = idxs[0];
let (hid, aid, hg, ag) = (hid_v[i0], aid_v[i0], hg_v[i0], ag_v[i0]);
let scorer_home = gtid_v[first] == hid;
let scorer = if scorer_home { hid } else { aid };
let conceded_by = if scorer_home { aid } else { hid };
let scorer_won = if scorer_home { hg > ag } else { ag > hg };
let conceded_won = if scorer_home { ag > hg } else { hg > ag };
let eff = minute_v[first] + added_v[first];
let bucket = if eff <= 30 { "1–30'" } else if eff <= 60 { "31–60'" } else { "61+'" };
let b = fbuckets.entry(bucket).or_insert((0, 0));
b.0 += 1;
if scorer_won { b.1 += 1; }
let e = fo.entry(scorer).or_default();
e.scored_first += 1;
if scorer_won { e.won_after_first += 1; }
let e = fo.entry(conceded_by).or_default();
e.conceded_first += 1;
if conceded_won { e.won_after_conceding += 1; }
}
let (mut sf, mut wf, mut cf, mut wc) = (0u64, 0u64, 0u64, 0u64);
for a in fo.values() {
sf += a.scored_first; wf += a.won_after_first;
cf += a.conceded_first; wc += a.won_after_conceding;
}
println!("matches decided by at least one goal: {}", match_goals.len());
println!("first scorer went on to WIN: {:.1}% of {}", wf as f64 / sf as f64 * 100.0, sf);
println!("first conceder WON anyway: {:.1}% of {}", wc as f64 / cf as f64 * 100.0, cf);
let mut frows: Vec<Vec<String>> = Vec::new();
for label in ["1–30'", "31–60'", "61+'"] {
if let Some((m, w)) = fbuckets.get(label) {
frows.push(vec![
label.to_string(),
m.to_string(),
w.to_string(),
format!("{:.1}%", *w as f64 / *m as f64 * 100.0),
]);
}
}
mars_table(&["first goal at", "matches", "scorer wins", "win%"], &frows);
matches decided by at least one goal: 3703
first scorer went on to WIN: 71.2% of 3703
first conceder WON anyway: 11.4% of 3703
| first goal at | matches | scorer wins | win% |
|---|---|---|---|
| 1–30' | 2187 | 1491 | 68.2% |
| 31–60' | 1045 | 756 | 72.3% |
| 61+' | 471 | 388 | 82.4% |
// protectors: best win% after scoring first (min 15)
let mut prot: Vec<(&i64, &FO)> = fo.iter().filter(|(_, a)| a.scored_first >= 15).collect();
prot.sort_by(|a, b| {
let ra = a.1.won_after_first as f64 / a.1.scored_first as f64;
let rb = b.1.won_after_first as f64 / b.1.scored_first as f64;
rb.partial_cmp(&ra).unwrap()
});
let prot_rows: Vec<Vec<String>> = prot.iter().take(15).map(|(tid, a)| {
vec![
names.get(*tid).cloned().unwrap_or_else(|| tid.to_string()),
a.scored_first.to_string(),
a.won_after_first.to_string(),
format!("{:.1}%", a.won_after_first as f64 / a.scored_first as f64 * 100.0),
]
}).collect();
mars_table(&["team (best protectors)", "scored first", "won", "protect rate"], &prot_rows);
| team (best protectors) | scored first | won | protect rate |
|---|---|---|---|
| Juventus W | 16 | 16 | 100.0% |
| AS Roma W | 21 | 21 | 100.0% |
| Barcelona WFC | 29 | 28 | 96.6% |
| Real Madrid CF W | 21 | 20 | 95.2% |
| Bayer Leverkusen | 40 | 38 | 95.0% |
| Bayern München W | 19 | 18 | 94.7% |
| England Women's | 17 | 16 | 94.1% |
| Seattle Reign | 15 | 14 | 93.3% |
| Stade Malherbe Caen | 15 | 14 | 93.3% |
| VfL Wolfsburg WFC | 15 | 14 | 93.3% |
| Juventus | 25 | 23 | 92.0% |
| Chelsea FCW | 59 | 53 | 89.8% |
| Paris Saint-Germain | 68 | 61 | 89.7% |
| Arsenal WFC | 58 | 52 | 89.7% |
| Napoli | 26 | 23 | 88.5% |
// recoverers: best win% after conceding first (min 15)
let mut rec: Vec<(&i64, &FO)> = fo.iter().filter(|(_, a)| a.conceded_first >= 15).collect();
rec.sort_by(|a, b| {
let ra = a.1.won_after_conceding as f64 / a.1.conceded_first as f64;
let rb = b.1.won_after_conceding as f64 / b.1.conceded_first as f64;
rb.partial_cmp(&ra).unwrap()
});
let rec_rows: Vec<Vec<String>> = rec.iter().take(15).map(|(tid, a)| {
vec![
names.get(*tid).cloned().unwrap_or_else(|| tid.to_string()),
a.conceded_first.to_string(),
a.won_after_conceding.to_string(),
format!("{:.1}%", a.won_after_conceding as f64 / a.conceded_first as f64 * 100.0),
]
}).collect();
mars_table(&["team (best recoverers)", "conceded first", "won", "recover rate"], &rec_rows);
| team (best recoverers) | conceded first | won | recover rate |
|---|---|---|---|
| Manchester City WFC | 17 | 9 | 52.9% |
| Arsenal WFC | 20 | 9 | 45.0% |
| Barcelona | 127 | 55 | 43.3% |
| Chelsea FCW | 15 | 6 | 40.0% |
| Arsenal | 18 | 7 | 38.9% |
| Paris Saint-Germain | 22 | 8 | 36.4% |
| Bayer Leverkusen | 24 | 7 | 29.2% |
| Orlando Pride | 18 | 4 | 22.2% |
| OGC Nice | 20 | 4 | 20.0% |
| Atlético Madrid | 25 | 5 | 20.0% |
| Chievo | 17 | 3 | 17.6% |
| Toulouse | 17 | 3 | 17.6% |
| Real Madrid | 23 | 4 | 17.4% |
| Torino | 23 | 4 | 17.4% |
| Lorient | 23 | 4 | 17.4% |
use plotters::prelude::*;
// protect rate for top 12 by volume
let mut chart_rows: Vec<(&i64, &FO)> = fo
.iter()
.filter(|(_, a)| a.scored_first >= 10 && a.won_after_first >= 5)
.collect();
chart_rows.sort_by(|a, b| b.1.won_after_first.cmp(&a.1.won_after_first));
chart_rows.truncate(12);
let mut labels7: Vec<String> = Vec::new();
let mut vals: Vec<f64> = Vec::new();
for (tid, a) in &chart_rows {
labels7.push(names.get(*tid).cloned().unwrap_or_default().chars().take(14).collect());
vals.push(a.won_after_first as f64 / a.scored_first as f64 * 100.0);
}
let ymax7 = vals.iter().cloned().fold(1.0_f64, f64::max) * 1.2;
let n7 = vals.len();
let figure = plotters::evcxr::evcxr_figure((720, 400), |root| {
root.fill(&WHITE)?;
let mut chart = ChartBuilder::on(&root)
.caption("Win rate after scoring first — the best protectors", ("sans-serif", 18))
.margin(10)
.x_label_area_size(80)
.y_label_area_size(45)
.build_cartesian_2d(-0.5_f64..(n7 as f64 - 0.5), 0.0_f64..ymax7)?;
chart.configure_mesh().x_labels(n7).x_label_formatter(&|x: &f64| {
labels7.get(*x as usize).cloned().unwrap_or_default()
}).draw()?;
chart.draw_series((0..n7).map(|i| {
Rectangle::new([(i as f64 - 0.35, 0.0), (i as f64 + 0.35, vals[i])], GREEN.filled())
}))?;
Ok(())
});
figure.evcxr_display();
Discussion
In 3,703 matches with goal timing, the opening goal is worth a lot — but less than the cliché suggests:
- First scorer wins 71.2% of the time; the first conceder wins just 11.4%.
- Timing matters: first goals in minutes 1–30 convert at 68.2%, rising to 82.4% for 61+' openers — a late first goal is nearly a match-winner because there's less time to equalise.
- Best protectors (min. 15 times scoring first): Juventus Women and AS Roma Women at a perfect 100%, Barcelona Femení 96.6%, Real Madrid Femenino 95.2%, Bayer Leverkusen 95.0% over 40 chances — the unbeaten-machine side protects leads like few others.
- Best recoverers after conceding first: Manchester City WFC 52.9%, Arsenal WFC 45.0%, and Barcelona (men's) 43.3% — 55 wins from 127 deficits, the best big-sample comeback side in the data.
Caveat: StatsBomb coverage includes women's competitions — "W" suffixed names are the women's teams, which skew the small-sample leaderboards.
Limitations. The analysis is limited to the competitions present in the database; player-level metrics exist only for StatsBomb-covered tournaments, and underlying event data may contain errors.
Conclusion
In 3,703 matches with goal timing, the opening goal is worth a lot — but less than the cliché suggests: the first scorer wins 71.2% of the time. Together these results answer the research question posed in the Introduction and quantify the pattern across 3,703 matches. The notebook provides a fully reproducible pipeline from raw CSV extracts to published figures.