Exercises: Situational Football
Exercise 1: Red Zone Calculation
A team had the following red zone results over a season:
| Outcome | Count |
|---|---|
| Touchdowns | 38 |
| Field Goals | 18 |
| Turnovers | 4 |
| Failed 4th Down | 2 |
Calculate: - Total red zone trips - TD rate - Points per trip - Overall scoring rate
Exercise 2: Third Down Analysis
A team's third down results by distance:
| Distance | Attempts | Conversions |
|---|---|---|
| 1-3 yards | 48 | 34 |
| 4-6 yards | 52 | 22 |
| 7+ yards | 85 | 24 |
Calculate conversion rates for each distance category and overall. How does each compare to league average?
Exercise 3: Two-Minute Drill Evaluation
A team had 12 two-minute drives with these results:
| Outcome | Count |
|---|---|
| Touchdown | 3 |
| Field Goal | 4 |
| Turnover | 2 |
| End of Half | 3 |
Calculate the scoring rate and evaluate against league benchmarks.
Exercise 4: Late and Close Performance
A team's EPA in different game situations:
| Situation | Plays | Total EPA |
|---|---|---|
| All plays | 1,020 | 51.0 |
| Late & Close | 145 | 4.4 |
Calculate EPA per play for each and determine if the team performs better or worse in high-leverage situations.
Exercise 5: Goal Line Efficiency
A team's results from the 1-2 yard line:
| Play Type | Attempts | TDs |
|---|---|---|
| Rush | 22 | 16 |
| Pass | 8 | 5 |
Calculate TD rates by play type. Which is more efficient?
Exercise 6: Leverage Weighting
Calculate leverage-weighted EPA for these plays:
| Win Prob | EPA | Plays |
|---|---|---|
| 0.50 | +0.15 | 50 |
| 0.30 | +0.08 | 80 |
| 0.70 | +0.10 | 80 |
| 0.85 | +0.02 | 40 |
Compare to unweighted EPA.
Exercise 7: Red Zone Defense
A defense faced 58 red zone trips and allowed: - 30 touchdowns - 22 field goals - 6 stops (no score)
Calculate the defensive red zone TD rate and points per trip allowed.
Exercise 8: Third Down Defense
A defense's third down results:
| Distance | Faced | Allowed Conversion |
|---|---|---|
| 1-3 yards | 42 | 28 |
| 4-6 yards | 48 | 18 |
| 7+ yards | 78 | 20 |
Calculate conversion rate allowed for each distance. Identify strengths and weaknesses.
Exercise 9: Situational Comparison
Compare two teams' situational performance:
| Metric | Team A | Team B |
|---|---|---|
| RZ TD Rate | 62% | 54% |
| 3rd Down Rate | 38% | 46% |
| Late/Close EPA | +0.08 | +0.02 |
| Overall EPA | +0.06 | +0.07 |
Which team is better situationally? Which might be overperforming their base efficiency?
Exercise 10: Clutch Analysis
A team's late/close performance over three seasons:
| Season | Late/Close EPA | Overall EPA | Difference |
|---|---|---|---|
| 2021 | +0.12 | +0.05 | +0.07 |
| 2022 | -0.03 | +0.06 | -0.09 |
| 2023 | +0.08 | +0.04 | +0.04 |
Does this team appear to have a "clutch" skill?
Exercise 11: Two-Minute EPA
A team's two-minute drive data:
| Drive | Plays | Total EPA | Result |
|---|---|---|---|
| 1 | 8 | +2.4 | TD |
| 2 | 5 | -1.2 | INT |
| 3 | 6 | +1.8 | FG |
| 4 | 7 | +0.5 | End |
Calculate average EPA per play and per drive.
Exercise 12: Situational Pass Rate
A team's pass rates by situation:
| Situation | Pass Rate |
|---|---|
| Overall | 58% |
| Red Zone | 52% |
| 3rd & Short | 45% |
| Two-Minute | 82% |
| Late & Close | 54% |
Which situations show the most pass rate adjustment? Is this appropriate?
Exercise 13: Red Zone Efficiency Trend
A team's red zone TD rate over five seasons:
| Season | TD Rate |
|---|---|
| 2019 | 68% |
| 2020 | 52% |
| 2021 | 65% |
| 2022 | 48% |
| 2023 | 62% |
Calculate the average and identify if there's a consistent pattern.
Exercise 14: Third Down Context
Analyze why a team might have these third down rates:
| Category | Rate |
|---|---|
| Overall | 35% |
| 3rd & Short | 72% |
| 3rd & Long | 18% |
| 3rd & Long frequency | 55% |
What's causing the poor overall rate despite good short-yardage performance?
Exercise 15: Points vs Touchdowns
Two teams with different red zone approaches:
| Team | Trips | TDs | FGs | Points |
|---|---|---|---|---|
| A | 55 | 38 | 12 | 302 |
| B | 62 | 32 | 25 | 299 |
Calculate TD rate and points per trip for each. Which approach is better?
Programming Exercises
Exercise 16: Red Zone Analyzer
Write a function to analyze red zone performance:
def analyze_red_zone(pbp: pd.DataFrame, team: str) -> dict:
"""
Comprehensive red zone analysis.
Returns:
- trips
- td_rate
- points_per_trip
- pass_rate_rz
- epa_rz
- by_yard_line (breakdowns by 1-5, 6-10, 11-20)
"""
pass
Exercise 17: Third Down Calculator
Build a third down analysis function:
def analyze_third_downs(pbp: pd.DataFrame, team: str) -> pd.DataFrame:
"""
Return DataFrame with third down stats by distance bucket.
Columns: distance_bucket, attempts, conversions, rate, epa, pass_rate
"""
pass
Exercise 18: Situational Comparison Tool
Create a function to compare situational vs overall performance:
def compare_situational(pbp: pd.DataFrame, team: str) -> dict:
"""
Compare team's situational vs overall performance.
Returns dict with:
- overall_epa
- red_zone_epa
- third_down_epa
- late_close_epa
- two_min_epa
- Each includes difference from overall
"""
pass
Exercise 19: Clutch Tester
Write a function to test clutch consistency:
def test_clutch_consistency(
pbp_by_year: dict,
team: str
) -> dict:
"""
Test whether clutch performance is consistent across years.
Returns:
- yearly_clutch_diff (list)
- year_over_year_correlation
- is_clutch_consistent (bool, if r > 0.3)
"""
pass
Exercise 20: Situational Report Generator
Build a comprehensive situational report:
def generate_situational_report(
pbp: pd.DataFrame,
team: str,
season: int
) -> str:
"""
Generate text report covering all situational categories.
Include:
- Red zone summary
- Third down breakdown
- Two-minute evaluation
- Late/close performance
- Comparisons to league average
- Strengths and weaknesses
"""
pass
Challenge Exercises
Challenge 1: Expected Red Zone Touchdowns
Build a model to predict expected red zone touchdowns:
- Calculate league-average TD rates by yard line
- For each team, sum expected TDs based on their trips at each yard line
- Compare expected to actual
- Identify teams over/underperforming expectation
Challenge 2: Third Down Situation Difficulty
Create a difficulty-adjusted third down metric:
- Model expected conversion rate by distance, field position, score
- Calculate "conversions above expected" for each team
- Identify teams that convert at higher rates than situation would suggest
Challenge 3: Late Game Win Probability Impact
Analyze which teams most impact late-game outcomes:
- Filter to plays with WP between 30-70%
- Calculate average WPA (win probability added) per play
- Compare offense and defense
- Identify teams that consistently swing games
Challenge 4: Situational Stability Analysis
Test which situational metrics are most stable year-to-year:
- Load 3+ years of data
- Calculate situational metrics for each team-year
- Compute year-to-year correlations
- Rank metrics by stability
- Determine which are predictive vs random
Challenge 5: Complete Situational Dashboard
Build an interactive situational analysis tool:
- Calculate all situational metrics for all teams
- Create rankings for each category
- Build composite situational score
- Generate visualizations
- Compare offense vs defense
- Track trends over season
Solutions
Solutions are available in code/exercise-solutions.py