Exercises: Team Efficiency Metrics
Exercise 1: Basic EPA Calculation
Calculate offensive and defensive EPA/play for a team with the following data:
| Play Type | Plays | Total EPA |
|---|---|---|
| Offensive | 1,024 | 51.2 |
| Defensive | 998 | -29.9 |
What is their net EPA/play?
Exercise 2: Success Rate Computation
Given the following play outcomes, calculate the team's overall success rate:
- 245 plays with positive EPA
- 305 plays with negative or zero EPA
Then classify their success rate tier based on league averages.
Exercise 3: Explosiveness Analysis
A team has the following explosive play data:
| Category | Explosive Plays | Total Plays |
|---|---|---|
| Pass (20+ yards) | 48 | 580 |
| Rush (10+ yards) | 32 | 420 |
Calculate their explosive play rates for each category and overall.
Exercise 4: Success-Explosiveness Quadrant
Classify the following teams into their success-explosiveness quadrants:
| Team | Success Rate | Explosive Rate |
|---|---|---|
| A | 52% | 14% |
| B | 44% | 16% |
| C | 50% | 9% |
| D | 42% | 8% |
Exercise 5: Net EPA Interpretation
Match each net EPA/play value with the correct team quality tier:
- Team A: +0.18
- Team B: +0.05
- Team C: -0.02
- Team D: -0.12
Tiers: Elite, Very Good, Above Average, Below Average, Poor
Exercise 6: Pass vs Rush Efficiency
A team has the following efficiency metrics:
| Play Type | EPA/Play |
|---|---|
| Pass | +0.08 |
| Rush | -0.05 |
Calculate their pass premium and determine if it's above or below league average (~0.08).
Exercise 7: Down-by-Down Success
Calculate success rate by down for a team with:
| Down | Successful Plays | Total Plays |
|---|---|---|
| 1st | 180 | 350 |
| 2nd | 120 | 280 |
| 3rd | 85 | 220 |
Compare each to league averages (1st: 48%, 2nd: 42%, 3rd: 38%).
Exercise 8: Defensive Efficiency
A defense allowed the following:
| Metric | Value |
|---|---|
| EPA allowed/play | +0.08 |
| Success rate allowed | 52% |
| Explosive plays allowed | 65 |
| Total plays faced | 980 |
Evaluate this defense's performance relative to league averages.
Exercise 9: Composite Score Calculation
Using the following normalized scores (0-100), calculate a composite team rating:
| Component | Score | Weight |
|---|---|---|
| Offensive EPA | 72 | 0.35 |
| Defensive EPA | 65 | 0.35 |
| Success Rate | 68 | 0.15 |
| Def Success | 58 | 0.15 |
Exercise 10: Garbage Time Filtering
A team's data before and after garbage time filtering:
| Metric | All Plays | Filtered (WP 5-95%) |
|---|---|---|
| Off EPA/play | +0.12 | +0.08 |
| Def EPA/play | +0.04 | +0.06 |
How did filtering change the team's apparent quality?
Exercise 11: Year-to-Year Correlation
Two metrics have the following year-to-year correlations:
- Metric A: r = 0.58
- Metric B: r = 0.31
If you're projecting next season, which metric is more reliable? What percentage of variance does each explain?
Exercise 12: Red Zone Efficiency
A team's red zone offense:
| Metric | Value |
|---|---|
| Red zone trips | 55 |
| Touchdowns | 32 |
| Field goals | 18 |
| Turnovers | 4 |
| Failed 4th | 1 |
Calculate TD rate, points per trip, and overall efficiency.
Exercise 13: Passing Situation Splits
Analyze passing efficiency by game situation:
| Situation | Pass EPA | Passes |
|---|---|---|
| 1st down | +0.06 | 180 |
| 2nd & long | -0.02 | 120 |
| 3rd down | +0.12 | 150 |
| Trailing | +0.15 | 200 |
| Leading | -0.05 | 130 |
Which situations show the best and worst performance?
Exercise 14: Rush Direction Analysis
A team's rushing efficiency by direction:
| Direction | EPA/Rush | Attempts |
|---|---|---|
| Left end | -0.08 | 45 |
| Left tackle | +0.02 | 80 |
| Left guard | -0.01 | 65 |
| Center | +0.05 | 40 |
| Right guard | +0.03 | 70 |
| Right tackle | -0.04 | 75 |
| Right end | -0.12 | 50 |
Identify the team's strongest and weakest rushing lanes.
Exercise 15: Score-Adjusted Analysis
Calculate win probability-weighted EPA for:
| WP Range | Plays | Total EPA | Weight |
|---|---|---|---|
| 0.4-0.6 | 200 | 12.0 | 1.5x |
| 0.2-0.4, 0.6-0.8 | 400 | 20.0 | 1.0x |
| 0.05-0.2, 0.8-0.95 | 350 | 10.5 | 0.5x |
What is the weighted EPA/play?
Exercise 16: Team Comparison
Compare two teams:
| Metric | Team A | Team B |
|---|---|---|
| Off EPA/play | +0.10 | +0.06 |
| Def EPA/play | +0.02 | -0.04 |
| Success Rate | 49% | 52% |
| Explosive Rate | 15% | 10% |
Which team is better overall? Why?
Exercise 17: Correlation Analysis
Given these correlations with wins:
| Metric | Correlation |
|---|---|
| Point Differential | 0.92 |
| Net EPA | 0.78 |
| Turnover Margin | 0.45 |
| Rush Yards | 0.25 |
Rank these metrics by predictive value. Why might rush yards have low correlation?
Exercise 18: Situational Defense
A defense's EPA allowed by situation:
| Down & Distance | EPA Allowed | Plays |
|---|---|---|
| 1st & 10 | +0.05 | 320 |
| 2nd & Short | -0.08 | 120 |
| 2nd & Long | +0.12 | 180 |
| 3rd & Short | +0.15 | 80 |
| 3rd & Long | -0.05 | 150 |
Identify the defense's strengths and weaknesses.
Exercise 19: Stability Projection
Project next year's EPA using regression to the mean:
Current EPA: +0.15 Stability coefficient: r = 0.55 League mean: 0.00
Use the formula: Projected = League Mean + (r × (Current - League Mean))
Exercise 20: Multi-Season Analysis
A team's metrics over three seasons:
| Season | Off EPA | Def EPA | Net EPA |
|---|---|---|---|
| 2021 | +0.06 | +0.04 | +0.02 |
| 2022 | +0.10 | -0.02 | +0.12 |
| 2023 | +0.08 | +0.01 | +0.07 |
Calculate 3-year averages and identify trends.
Programming Exercises
Exercise 21: Team EPA Calculator
Write a Python function that calculates team efficiency metrics:
def calculate_team_efficiency(pbp: pd.DataFrame, team: str) -> dict:
"""
Calculate comprehensive efficiency metrics for a team.
Returns dict with:
- off_epa_play: Offensive EPA per play
- def_epa_play: Defensive EPA per play
- net_epa: Net EPA per play
- success_rate: Offensive success rate
- explosive_rate: Explosive play rate
"""
pass
Exercise 22: League Rankings
Write a function that ranks all teams by multiple efficiency metrics:
def rank_teams(pbp: pd.DataFrame) -> pd.DataFrame:
"""
Return DataFrame with all teams ranked by:
- Offensive EPA (desc)
- Defensive EPA (asc - lower is better)
- Net EPA (desc)
- Success Rate (desc)
Include composite rank as average of all ranks.
"""
pass
Exercise 23: Garbage Time Filter
Implement a garbage time filter:
def filter_garbage_time(pbp: pd.DataFrame,
min_wp: float = 0.05,
max_wp: float = 0.95) -> pd.DataFrame:
"""
Remove plays where win probability is extreme.
Args:
pbp: Play-by-play data
min_wp: Minimum win probability to include
max_wp: Maximum win probability to include
Returns:
Filtered DataFrame
"""
pass
Exercise 24: Success-Explosiveness Visualization
Create a visualization function:
def plot_success_explosiveness(team_metrics: pd.DataFrame) -> None:
"""
Create scatter plot of success rate vs explosive rate.
- Color by net EPA
- Add quadrant lines at median values
- Label each team
- Add title and axis labels
"""
pass
Exercise 25: Team Report Generator
Build a complete team report generator:
def generate_team_report(pbp: pd.DataFrame, team: str, season: int) -> str:
"""
Generate comprehensive text report for a team.
Include:
- Overall efficiency summary
- Offensive analysis (pass/rush splits)
- Defensive analysis
- Situational breakdowns
- League rankings
- Strengths and weaknesses
"""
pass
Challenge Exercises
Challenge 1: Opponent-Adjusted Metrics
Calculate opponent-adjusted EPA:
- For each team's opponents, find their average EPA allowed
- Adjust team's EPA by subtracting opponent average
- Compare raw vs adjusted rankings
How much do rankings change?
Challenge 2: Predictive Model
Build a simple wins predictor:
- Use net EPA to predict wins
- Calculate correlation and RMSE
- Compare to point differential model
- Identify teams that over/underperformed predictions
Challenge 3: Stability Analysis
Analyze metric stability across seasons:
- Load 3 years of data
- Calculate year-to-year correlations for: - Offensive EPA - Defensive EPA - Pass EPA - Rush EPA - Success Rate
- Which metrics are most stable?
Challenge 4: Composite Rating System
Design your own composite rating:
- Choose which metrics to include
- Determine appropriate weights
- Normalize all metrics to common scale
- Test correlation with wins
- Compare to simple net EPA
Challenge 5: Real-Time Dashboard
Create an efficiency dashboard:
- Load current season data
- Calculate all major efficiency metrics
- Create visualizations for: - League-wide rankings - Team-specific breakdown - Trend over time (by week)
- Export to HTML or create interactive display
Solutions
Solutions are available in code/exercise-solutions.py