Exercises: Defensive Analytics
Difficulty Levels
- Level 1 (Foundational): Basic defensive metric calculations
- Level 2 (Applied): Team-level defensive analysis
- Level 3 (Intermediate): Situational and split analysis
- Level 4 (Advanced): Opponent adjustment and attribution
- Level 5 (Expert): Comprehensive defensive evaluation
Section 1: Team Defensive Metrics (Level 1-2)
Exercise 1.1: EPA Allowed
Level 1 | Core Metric
Calculate EPA allowed for all teams: 1. Filter to regular plays (pass and run) 2. Calculate mean EPA allowed by defensive team 3. Rank teams from best (most negative) to worst 4. What is the range from best to worst?
# Your code here
Exercise 1.2: Defensive Success Rate
Level 2 | Consistency
Calculate success rate allowed: 1. Define success as offense achieving EPA > 0 2. Calculate success rate allowed by team 3. Compare to EPA allowed - correlation? 4. Which teams limit both magnitude AND frequency?
# Your code here
Exercise 1.3: Pass vs Run Defense
Level 2 | Split Analysis
Analyze pass and run defense separately: 1. Calculate pass EPA allowed by team 2. Calculate run EPA allowed by team 3. Identify pass defense specialists 4. Identify run defense specialists 5. Which defenses are balanced?
# Your code here
Exercise 1.4: Explosive Play Prevention
Level 2 | Big Plays
Analyze explosive play prevention: 1. Define explosive pass (20+ yards) and run (10+ yards) 2. Calculate explosive rate allowed by team 3. Which teams prevent big plays best? 4. Correlation with overall defensive EPA?
# Your code here
Exercise 1.5: Negative Play Generation
Level 2 | Disruption
Analyze ability to generate negative plays: 1. Calculate rate of plays for negative yards 2. Calculate rate of EPA < -0.5 plays 3. Which defenses are most disruptive? 4. Is this pass rush or run stuffing?
# Your code here
Section 2: Pass Rush Analysis (Level 2-3)
Exercise 2.1: Sack Rate Analysis
Level 2 | Basic
Calculate defensive sack rate: 1. Calculate sacks per dropback by team 2. Rank defenses by sack rate 3. What is the league average? 4. How much variance exists?
# Your code here
Exercise 2.2: Pressure Rate Estimation
Level 3 | Composite
Estimate pressure rate from PBP: 1. Define pressure as sack OR QB hit OR scramble 2. Calculate pressure rate by team 3. Compare to sack rate - what's the relationship? 4. Which teams have high pressure but low sacks?
# Your code here
Exercise 2.3: Pass Rush Efficiency
Level 3 | Efficiency
Analyze pass rush impact on passing: 1. Calculate EPA on pressured vs clean plays 2. How much does pressure affect EPA? 3. Which defenses maximize pressure impact? 4. Which defenses generate pressure but don't capitalize?
# Your code here
Exercise 2.4: Blitz Effectiveness
Level 3 | Scheme
Analyze blitz effectiveness (if data available): 1. Identify blitz plays (5+ pass rushers) 2. Compare sack rate on blitz vs non-blitz 3. Compare EPA allowed on blitz vs non-blitz 4. Which defenses blitz effectively?
# Your code here
Exercise 2.5: Sack Rate Stability
Level 3 | Reliability
Test sack rate stability: 1. Split season into halves 2. Calculate sack rate for each half 3. What is the correlation? 4. How predictive is early-season sack rate?
# Your code here
Section 3: Coverage Analysis (Level 2-3)
Exercise 3.1: Completion Percentage Allowed
Level 2 | Basic Coverage
Analyze completion percentage allowed: 1. Calculate comp % allowed (excluding sacks) 2. Calculate yards per target allowed 3. Rank teams by coverage metrics 4. Compare to passer rating allowed
# Your code here
Exercise 3.2: Deep Pass Defense
Level 3 | High Value
Analyze defense against deep passes: 1. Define deep as 15+ air yards 2. Calculate completion % on deep passes 3. Calculate EPA allowed on deep passes 4. Which teams defend deep best?
# Your code here
Exercise 3.3: YAC Allowed
Level 3 | Tackling
Analyze yards after catch allowed: 1. Calculate average YAC allowed 2. Calculate explosive YAC (15+) rate 3. Which teams limit YAC best? 4. Correlation with total yards allowed?
# Your code here
Exercise 3.4: Air Yards vs YAC Balance
Level 3 | Decomposition
Decompose passing yards allowed: 1. Calculate air yards allowed per target 2. Calculate YAC allowed per completion 3. Which teams allow short passes but tackle well? 4. Which teams allow deep completions?
# Your code here
Exercise 3.5: Target Quality
Level 3 | Context
Analyze quality of targets against defense: 1. Calculate average ADOT against each defense 2. Do good defenses face shorter throws? 3. How does this affect coverage metrics?
# Your code here
Section 4: Run Defense (Level 2-3)
Exercise 4.1: Run Stuffing
Level 2 | Basic
Calculate defensive stuff rate: 1. Calculate rate of runs stopped at/behind LOS 2. Calculate TFL rate 3. Rank run-stuffing defenses 4. Compare to YPC allowed
# Your code here
Exercise 4.2: Yards Per Carry Allowed
Level 2 | Traditional
Analyze YPC allowed: 1. Calculate YPC allowed by team 2. Calculate run success rate allowed 3. Compare to run EPA allowed 4. Which tells more?
# Your code here
Exercise 4.3: Explosive Run Prevention
Level 3 | Big Plays
Analyze explosive run prevention: 1. Calculate 10+ yard run rate allowed 2. Calculate 20+ yard run rate allowed 3. Which teams prevent big runs best? 4. Correlation with overall run defense?
# Your code here
Exercise 4.4: Run Direction Defense
Level 3 | Directional
Analyze run defense by direction: 1. Calculate YPC allowed left, middle, right 2. Which teams have directional weaknesses? 3. Does this relate to scheme or personnel?
# Your code here
Exercise 4.5: Second Level Defense
Level 3 | Linebacker Play
Analyze defense at second level: 1. Calculate % of runs reaching 4+ yards 2. This proxy for second level failure 3. Which teams stop runs before linebackers? 4. Which have good linebacker play?
# Your code here
Section 5: Situational Defense (Level 3-4)
Exercise 5.1: Third Down Defense
Level 3 | Critical
Analyze third down defense: 1. Calculate 3rd down conversion rate allowed 2. Split by distance (short, medium, long) 3. Calculate 3rd down EPA allowed 4. Which teams get off the field?
# Your code here
Exercise 5.2: Red Zone Defense
Level 3 | Scoring
Analyze red zone defense: 1. Calculate TD rate allowed in red zone 2. Calculate red zone EPA allowed 3. Compare to overall defensive rank 4. Do some teams bend but not break?
# Your code here
Exercise 5.3: Late and Close Defense
Level 4 | Clutch
Analyze clutch defense: 1. Filter to 4th quarter, within 8 points 2. Calculate EPA allowed in these situations 3. Compare to full-game metrics 4. Which teams step up when it matters?
# Your code here
Exercise 5.4: First Down Defense
Level 3 | Setting Up
Analyze first down defense: 1. Calculate 1st down EPA allowed 2. Calculate average 1st down yards allowed 3. Setting up 2nd/3rd down matters 4. Which teams win on first down?
# Your code here
Exercise 5.5: Goal Line Defense
Level 4 | Extreme
Analyze goal line defense: 1. Filter to inside the 5, goal to go 2. Calculate run and pass success rates 3. TD rate allowed 4. Which teams hold at the goal line?
# Your code here
Section 6: Advanced Analysis (Level 4-5)
Exercise 6.1: Opponent Adjustment
Level 4 | Context
Adjust defensive metrics for opponents: 1. Calculate offensive quality faced 2. Create expected EPA based on opponents 3. Calculate opponent-adjusted defensive EPA 4. Which teams' rankings change most?
# Your code here
Exercise 6.2: Turnover Analysis
Level 4 | Variance
Analyze turnover generation: 1. Calculate INT rate and fumble rate 2. Calculate EPA swing from turnovers 3. Correlation with overall defensive EPA? 4. How much is skill vs luck?
# Your code here
Exercise 6.3: Game Script Analysis
Level 4 | Context
Analyze defense in different game scripts: 1. Split by score differential (leading, tied, trailing) 2. Calculate EPA allowed in each 3. How does game script affect defensive stats? 4. Which teams perform consistently regardless?
# Your code here
Exercise 6.4: Defensive Composite Index
Level 5 | Comprehensive
Build a composite defensive rating: 1. Combine pass and run defense 2. Include situational metrics 3. Weight appropriately 4. Normalize to 0-100 scale
class DefensiveIndex:
def __init__(self, pbp):
pass
def calculate_composite(self, team):
pass
def rank_all_teams(self):
pass
Exercise 6.5: Complete Defensive Report
Level 5 | Capstone
Generate comprehensive defensive evaluation: 1. Select a team to analyze 2. Include all metric categories 3. Compare to league averages 4. Identify strengths and weaknesses 5. Make recommendations
# Your code here
Submission Guidelines
For each exercise: 1. Include all code with comments 2. Provide visualizations where appropriate 3. Interpret findings with appropriate caveats 4. Acknowledge defensive metric limitations
Grading Rubric
| Level | Points | Focus |
|---|---|---|
| 1 | 2 each | Correct calculation |
| 2 | 3 each | Calculation + interpretation |
| 3 | 4 each | Multi-metric analysis |
| 4 | 5 each | Context and adjustment |
| 5 | 6 each | Comprehensive evaluation |