Structured take-home-style analysis with business recommendations
Risk Pricing: Identify which loan grades carry disproportionate default risk to inform underwriting policy and pricing tiers.
SELECT grade,
COUNT(*) AS total_loans,
SUM(CASE WHEN default_flag = 1 THEN 1 ELSE 0 END) AS defaults,
ROUND(AVG(default_flag), 4) AS default_rate
FROM lending
GROUP BY grade
ORDER BY gradeRecommendation
Grades F and G show default rates exceeding 25%. Recommend tightening origination criteria or increasing risk premiums by 150-200 bps for sub-prime grades.
Portfolio Diversification: Measure correlation between sector returns to identify hidden concentration risk in seemingly diversified portfolios.
SELECT a.Sector AS sector_a,
b.Sector AS sector_b,
ROUND(CORR(a.Return_1D, b.Return_1D), 3) AS correlation
FROM stocks a
JOIN stocks b ON a.Date = b.Date AND a.Sector < b.Sector
WHERE a.Return_1D IS NOT NULL AND b.Return_1D IS NOT NULL
GROUP BY a.Sector, b.Sector
ORDER BY correlation DESC
LIMIT 10Recommendation
Tech-Consumer Discretionary correlation exceeds 0.75, creating a hidden 40%+ effective concentration. Recommend rebalancing toward Healthcare/Utilities as partial hedges.
Recession Forecasting: Track historical yield curve inversions as a leading indicator for recession risk and portfolio de-risking triggers.
SELECT Date, Yield10Y, Yield2Y,
ROUND(Yield10Y - Yield2Y, 3) AS spread
FROM fred
WHERE Yield10Y IS NOT NULL AND Yield2Y IS NOT NULL
AND Yield10Y < Yield2Y
ORDER BY Date DESC
LIMIT 10Recommendation
Each recorded inversion preceded a recession within 12-18 months. When spread falls below -0.5%, trigger a defensive rotation: reduce equity allocation by 10-15% and increase duration-matched treasuries.
Loss Mitigation: Identify borrowers with compounding risk factors (low FICO + high DTI) to prioritize for early intervention and workout programs.
SELECT
CASE
WHEN fico_score < 650 AND dti > 0.4 THEN 'Critical'
WHEN fico_score < 700 AND dti > 0.35 THEN 'Elevated'
ELSE 'Standard'
END AS risk_tier,
COUNT(*) AS borrowers,
ROUND(AVG(default_flag), 4) AS default_rate,
ROUND(AVG(loan_amnt), 0) AS avg_loan
FROM lending
GROUP BY risk_tier
ORDER BY default_rate DESCRecommendation
Critical-tier borrowers default at 3-4x the standard rate. Route these applications through enhanced review with manual DTI verification and employment confirmation before approval.