Chapter 12 Exercises: Defensive Metrics and Analysis
Overview
These exercises progress from fundamental defensive statistics through advanced defensive value modeling. You will work with real match data to calculate, contextualize, and visualize defensive performance metrics.
Data Requirements: StatsBomb open data (accessed via statsbombpy)
Estimated Completion Time: 8-10 hours
Part 1: Core Defensive Statistics (Exercises 1-6)
Exercise 1: Tackle Analysis
Load events from a World Cup 2018 match and analyze tackles.
Tasks: a) Calculate total tackles, tackles won, and tackle success rate for each team b) Create a function that categorizes tackles by pitch zone (defensive, middle, attacking third) c) Identify the player with the highest tackle success rate (minimum 3 attempts) d) Calculate tackles per 90 minutes for players with at least 45 minutes played
Expected Output: Table showing tackle statistics by player with zone breakdown
Exercise 2: Interception Patterns
Analyze interceptions to understand defensive reading ability.
Tasks: a) Count interceptions for each player in the match b) Map interception locations to a 12x8 grid c) Calculate "interception density" for each zone d) Identify which zones had the highest interception activity for each team
Expected Output: Heatmap showing interception density by zone for each team
Exercise 3: Clearance Context
Examine clearances and their context.
Tasks: a) Count clearances by player and categorize by body part (head, foot) b) Calculate the percentage of clearances made under pressure c) Determine average clearance distance from own goal d) Identify patterns in clearance timing (early vs. late in match)
Expected Output: Summary statistics with clearance patterns by half
Exercise 4: Block Value Calculation
Quantify the value of shot blocks.
Tasks: a) Identify all blocked shots in a match b) Calculate total xG that was blocked (sum of xG for blocked shots) c) Attribute blocks to individual players where possible d) Compare blocked shot xG to actual goals conceded
Expected Output: Report showing xG prevented through blocks
Exercise 5: Aerial Duel Dominance
Analyze aerial duels comprehensively.
Tasks: a) Calculate aerial duel statistics for each player b) Create an "Aerial Dominance Index" = (win_rate - 0.5) * total_duels c) Analyze aerial duel locations (defensive vs. attacking aerials) d) Identify the most dominant aerial player on each team
Expected Output: Aerial duel rankings with dominance index
Exercise 6: Defensive Action Summary
Create a comprehensive defensive action summary.
Tasks: a) Build a function that calculates all core defensive metrics for a player b) Normalize all metrics to per-90-minute rates c) Create a summary table for all players with significant minutes d) Rank players by total defensive actions per 90
Expected Output: Complete defensive statistics table sorted by total actions
Part 2: Contextual Adjustments (Exercises 7-12)
Exercise 7: Possession Adjustment
Adjust defensive statistics for team possession.
Tasks: a) Calculate team possession percentages for a match b) Implement possession-adjusted defensive actions (PADA) c) Compare raw vs. possession-adjusted rankings d) Discuss which players' rankings changed most and why
Expected Output: Comparison table of raw vs. adjusted defensive metrics
Exercise 8: Opposition Strength Adjustment
Account for opposition quality in defensive evaluation.
Tasks: a) Load multiple matches from a competition b) Calculate opposition attacking strength (xG per 90) for each match c) Weight defensive actions by opposition strength d) Identify defenders who perform better against stronger opposition
Expected Output: Opposition-weighted defensive statistics
Exercise 9: Game State Analysis
Analyze how defensive behavior changes with game state.
Tasks: a) Track score throughout a match to determine game state b) Categorize defensive actions by game state (leading, level, trailing) c) Calculate defensive action rates for each game state d) Identify systematic differences in defensive approach
Expected Output: Defensive statistics segmented by game state
Exercise 10: Positional Context
Evaluate defenders based on their positional role.
Tasks: a) Identify player positions from lineup data or event patterns b) Create position-specific benchmark values for defensive metrics c) Calculate percentile rankings within position d) Compare a center-back's profile to full-back benchmarks
Expected Output: Position-adjusted percentile rankings
Exercise 11: Temporal Patterns
Analyze how defensive performance varies through matches.
Tasks: a) Divide match into 15-minute segments b) Calculate defensive action rates for each segment c) Identify patterns (fatigue effects, tactical changes) d) Compare first half vs. second half defensive intensity
Expected Output: Time series visualization of defensive activity
Exercise 12: Zone-Specific Success Rates
Calculate context-specific success rates.
Tasks: a) Define three pitch zones (defensive, middle, attacking third) b) Calculate tackle success rate by zone c) Calculate interception success by zone (if data available) d) Identify which defenders are most effective in which zones
Expected Output: Zone-specific success rate matrix
Part 3: Pressing Metrics (Exercises 13-18)
Exercise 13: Individual Pressure Analysis
Analyze individual pressing contributions.
Tasks: a) Count pressure events for each player b) Calculate pressures per 90 minutes c) Determine pressure locations (average x, y coordinates) d) Identify the highest-pressing player on each team
Expected Output: Pressure statistics with location data
Exercise 14: Pressure Success Rate
Evaluate pressing effectiveness.
Tasks: a) Define pressure success as team possession within 5 seconds b) Calculate pressure success rate for each player c) Calculate "valuable pressures" (those leading to shots within 10 seconds) d) Rank players by pressure effectiveness, not just volume
Expected Output: Pressure effectiveness rankings
Exercise 15: PPDA Calculation
Implement Passes Per Defensive Action.
Tasks: a) Implement PPDA calculation for a single match b) Calculate PPDA for each team c) Segment PPDA by match phase (0-30, 30-60, 60-90 minutes) d) Compare the pressing intensity of both teams
Expected Output: PPDA values by team and match phase
Exercise 16: PPDA League Analysis
Calculate PPDA across a competition.
Tasks: a) Load all matches from a World Cup group stage b) Calculate PPDA for each team in each match c) Calculate average PPDA for each team d) Create a pressing intensity ranking
Expected Output: Team PPDA rankings for the competition
Exercise 17: High Turnovers
Analyze high turnovers and their outcomes.
Tasks: a) Identify ball recoveries in the attacking third (x > 80) b) Track outcomes within 10 seconds of each high turnover c) Calculate shots and xG generated from high turnovers d) Compare high turnover effectiveness between teams
Expected Output: High turnover analysis with outcome tracking
Exercise 18: Counter-Pressing Analysis
Evaluate counter-pressing (gegenpressing) effectiveness.
Tasks: a) Identify possession losses for each team b) Detect pressure events within 5 seconds of each loss c) Calculate counter-press attempt rate d) Calculate counter-press regain rate (possession recovered within 8 seconds)
Expected Output: Counter-pressing statistics for each team
Part 4: Defensive Positioning and Value (Exercises 19-24)
Exercise 19: Defensive Line Height
Analyze team defensive positioning.
Tasks: a) Calculate average x-coordinate of defensive actions for each team b) Track defensive line height through the match (by 10-minute segments) c) Correlate defensive line height with opponent possession % d) Identify high-line vs. low-block phases
Expected Output: Defensive line height time series
Exercise 20: Defensive Coverage Map
Create defensive coverage visualizations.
Tasks: a) Create a 12x8 grid coverage map for each defender b) Calculate defensive action density in each zone c) Identify primary coverage zones for each defender d) Visualize coverage maps on a pitch diagram
Expected Output: Defensive coverage heatmaps for key defenders
Exercise 21: xG Prevented Model
Implement expected goals prevented calculation.
Tasks: a) Calculate xG from blocked shots for each defender b) Implement xT prevented from interceptions c) Sum component values for total defensive value d) Compare defenders by xG/xT prevented
Expected Output: Defensive value rankings by xG prevented
Exercise 22: Team Defensive Shape
Analyze collective defensive organization.
Tasks: a) Calculate average defensive positions for all players b) Measure defensive width (y-coordinate spread) c) Measure defensive depth (x-coordinate spread) d) Draw the defensive shape as a convex hull
Expected Output: Visualization of team defensive shape
Exercise 23: Transition Defense
Evaluate defensive performance during transitions.
Tasks: a) Identify possession changes (turnovers) b) Track opponent shots within 15 seconds of turnovers c) Calculate transition xG conceded d) Analyze counter-pressing response to turnovers
Expected Output: Transition defense statistics
Exercise 24: xG Conceded Analysis
Comprehensive analysis of chances conceded.
Tasks: a) Analyze all shots conceded by a team b) Categorize by shot type (open play, set piece, counter) c) Identify zones where most dangerous chances were conceded d) Calculate post-shot xG vs. pre-shot xG for goalkeeper evaluation context
Expected Output: xG conceded breakdown by situation type
Part 5: Comprehensive Applications (Exercises 25-30)
Exercise 25: Defender Profile Builder
Build comprehensive defender profiles.
Tasks:
a) Create a DefenderProfile class that calculates all relevant metrics
b) Include ball-winning, ball-negating, pressing, aerial, and ball-playing dimensions
c) Normalize metrics to per-90 rates
d) Generate a profile for a specific defender
Expected Output: Complete defender profile with all metrics
Exercise 26: Defender Radar Chart
Create radar chart visualizations for defenders.
Tasks: a) Select 7-8 key metrics for radar visualization b) Normalize metrics to 0-100 scale using benchmark maximums c) Create radar charts for two defenders d) Add comparison overlay functionality
Expected Output: Comparative radar charts for two defenders
Exercise 27: Defender Similarity Search
Find similar defenders using statistical profiles.
Tasks: a) Calculate defender profiles for all defenders in a competition b) Standardize metrics (z-scores) c) Calculate Euclidean distance between defender profiles d) Find the 5 most similar defenders to a target defender
Expected Output: Similarity rankings with distance scores
Exercise 28: Defensive Weakness Identification
Identify team defensive vulnerabilities.
Tasks: a) Analyze shot locations conceded b) Identify zones with highest xG conceded c) Analyze set piece vulnerability d) Generate a defensive weakness report
Expected Output: Defensive vulnerability report with recommendations
Exercise 29: Defender Recruitment Analysis
Apply defensive metrics to recruitment scenarios.
Tasks: a) Define requirements for a "ball-playing center-back" role b) Create a scoring function based on role requirements c) Rank available defenders by fit score d) Generate a shortlist with profile summaries
Expected Output: Recruitment shortlist with fit scores
Exercise 30: Match Defensive Report
Create a comprehensive match defensive analysis report.
Tasks: a) Generate all relevant team defensive statistics b) Create individual defender summaries c) Include visualizations (heatmaps, radar charts) d) Produce a structured report with insights
Expected Output: Complete match defensive analysis document
Submission Guidelines
Code Requirements
- Well-commented Python code with docstrings
- Functions should be reusable and modular
- Include error handling for missing data
- Use type hints where appropriate
Analysis Requirements
- Interpret results, don't just calculate them
- Discuss limitations of each metric
- Consider contextual factors in interpretation
- Compare findings to expected patterns
Visualization Requirements
- Clear, labeled axes
- Appropriate color schemes
- Legends where needed
- Professional formatting
Grading Rubric
| Component | Weight |
|---|---|
| Code Quality | 25% |
| Statistical Accuracy | 25% |
| Interpretation | 25% |
| Visualization | 15% |
| Documentation | 10% |
Additional Challenges
For students seeking additional practice:
-
Tracking Data Integration: If tracking data is available, incorporate positional data for true spatial analysis
-
Machine Learning Extension: Build a model to predict defensive action probability given match context
-
Multi-Season Analysis: Track defender performance evolution across multiple seasons
-
Video Validation: Select 10 defensive actions and validate the event data against video
-
Custom Metric Development: Propose and implement a novel defensive metric with theoretical justification