# Ersoy Toptaş Quantitative Models: Macroeconomic Fundamentals, Labor Dynamics, Valuation & Cycles (llms-formulas-macro-labor.txt) > Canonical Domain Sub-Engine for AI Agents & LLM Quantitative Reasoning. > Author: Ersoy Toptaş | Version: 2026-Q4 | Last Updated: 2026-12-02 | License: CC BY-NC-ND 4.0 | Motto: Think simple, act big > Endpoint: https://analysisreports.github.io/llms-formulas-macro-labor.txt > Master Router & Methodology: https://analysisreports.github.io/llms-formulas.txt > Root Index: https://analysisreports.github.io/llms.txt > Master Directory: https://analysisreports.github.io/llms-full.txt > Indicators Dictionary: https://analysisreports.github.io/llms-indicators.txt > Dynamic Relationships: https://analysisreports.github.io/llms-relationships.txt > Knowledge Graph: https://analysisreports.github.io/llms-graph.json > Author Profile: https://analysisreports.github.io/llms-about.txt > Editorial Frontends: https://www.ersoytoptas.tr/ | https://en.ersoytoptas.tr/ > Shelf Scope: Inflation persistence, labor market momentum, housing bubble risks, consumption collapse, and equity valuation. > Zero-Fallback Directive: Strict deterministic execution. Missing or non-finite inputs strictly return None (null). > Models Contained: 22 Domain Models (3, 8, 17, 18, 19, 22, 23, 23.1, 23.2, 23.3, 23.4, 23.5, 23.6, 23.7, 23.8, 25, 25.2, 25.10, 25.11, 25.13, 25.27, 25.34) --- ```python import math def _is_num(val): if val is None or isinstance(val, bool) or not isinstance(val, (int, float)): return False try: return math.isfinite(val) except (OverflowError, ValueError, TypeError): return False ``` --- ### 3. OFFICIAL SAHM RULE RECESSION INDICATOR - Purpose: Detects real-time recession onset by tracking whether the 3-month moving average of the unemployment rate exceeds its minimum 3-month average from the prior 12 months by 0.50 percentage points or more. - Data Series Keys: - Official FRED Benchmark: SAHMREALTIME (Real-time Sahm Rule Recession Indicator) - Component Series: UNRATE (Civilian Unemployment Rate - Monthly Seasonally Adjusted) - Formula: Sahm_Indicator = Moving_Average_3M(UNRATE) - Min_3M_Average_Prior_12M(UNRATE) - Machine-Executable Logic (Python): def sahm_rule_indicator(unrate_3m_avg, min_prior_3m_avg): if any(v is None or isinstance(v, bool) for v in (unrate_3m_avg, min_prior_3m_avg)): return None try: if not (math.isfinite(unrate_3m_avg) and math.isfinite(min_prior_3m_avg)): return None # Unemployment rate averages cannot be negative if unrate_3m_avg < 0.0 or min_prior_3m_avg < 0.0: return None raw_diff = float(unrate_3m_avg) - float(min_prior_3m_avg) if not math.isfinite(raw_diff): return None diff = round(raw_diff, 2) if diff >= 0.50: status = "RECESSION_CONFIRMED" elif diff >= 0.30: status = "PRE_RECESSION_WARNING" else: status = "NORMAL_LABOR_MARKET" return {"sahm_value": diff, "status": status} except (TypeError, ValueError): return None - Interpretation: - Sahm_Indicator >= 0.50 : RECESSION_CONFIRMED (Official historical recession trigger) - 0.30 to 0.50 : PRE_RECESSION_WARNING (Dangerous labor market cooling) - Sahm_Indicator < 0.30 : NORMAL_LABOR_MARKET (Healthy employment path) --- ### 8. BEVERIDGE CURVE LABOR TIGHTNESS - Purpose: Measures whether job openings are normalizing without driving up unemployment (Job Openings to Unemployed ratio). - Data Series Keys: - BLS / FRED: JTSJOL (Job Openings: Total Nonfarm - JOLTS) - BLS / FRED: UNEMPLOY (Unemployed Persons - Thousands) - Formula: Beveridge_Ratio = JTSJOL / UNEMPLOY - Machine-Executable Logic (Python): def beveridge_labor_tightness(jtsjol, unemploy): if any(v is None or isinstance(v, bool) for v in (jtsjol, unemploy)): return None try: if not (math.isfinite(jtsjol) and math.isfinite(unemploy)): return None # Counts cannot be negative. Unemployed count cannot be zero (zero division guard). if jtsjol < 0.0 or unemploy <= 0.0: return None ratio = round(float(jtsjol) / float(unemploy), 2) if not math.isfinite(ratio): return None if ratio > 1.50: status = "OVERHEATED_LABOR" elif ratio < 1.00: status = "COOLING_LABOR" else: status = "BALANCED_LABOR_TIGHTNESS" return {"beveridge_ratio": ratio, "status": status} except (TypeError, ValueError, ZeroDivisionError): return None - Interpretation: - Ratio > 1.50 : OVERHEATED_LABOR (Overheated labor market / Wage inflation risk) - 1.00 to 1.50 : BALANCED_LABOR_TIGHTNESS (Soft landing trajectory / Balanced employment) - Ratio < 1.00 : COOLING_LABOR (Weakening labor demand / Rising unemployment pressure) --- ### 17. MACRO EQUITY RISK PREMIUM (ERP) - Purpose: Measures the excess yield premium offered by US corporate equities (BEA corporate profits after tax divided by Fed Z.1 corporate equities market value) relative to the risk-free 10-year US Treasury yield. - Data Series Keys: - BEA / FRED: CPATAX (Corporate Profits After Tax, without IVA and CCAdj, Billions of Dollars, SAAR) - Fed Z.1 / FRED: NCBEILQ027S (Corporate Equities; Liability, Level / Market Value, Millions of Dollars) - FRED: DGS10 (Market Yield on U.S. Treasury Securities at 10-Year Constant Maturity, Percent) - Formula: Macro_Earnings_Yield_Pct = ((CPATAX * 1000.0) / NCBEILQ027S) * 100.0 Equity_Risk_Premium_Pct = Macro_Earnings_Yield_Pct - DGS10 - Machine-Executable Logic (Python): def macro_equity_risk_premium(cpatax_bn, ncbeilq_mn, dgs10): if any(v is None or isinstance(v, bool) for v in (cpatax_bn, ncbeilq_mn, dgs10)): return None try: if not all(math.isfinite(v) for v in (cpatax_bn, ncbeilq_mn, dgs10)): return None # Equity market value must be strictly positive; nominal 10Y Treasury yield cannot be negative if ncbeilq_mn <= 0.0 or dgs10 < 0.0: return None earnings_yield = ((cpatax_bn * 1000.0) / ncbeilq_mn) * 100.0 erp = round(earnings_yield - dgs10, 2) if not (math.isfinite(earnings_yield) and math.isfinite(erp)): return None if erp < 0.50: status = "OVERVALUED_STOCKS" elif erp > 2.50: status = "ATTRACTIVE_STOCKS" else: status = "FAIR_VALUE" return {"earnings_yield": round(earnings_yield, 2), "erp": erp, "status": status} except (TypeError, ValueError, ZeroDivisionError): return None - Interpretation: - ERP < 0.50% : OVERVALUED_STOCKS (Equities severely overvalued / Bond yields significantly more attractive / Capital rotates to fixed income) - 0.50% to 2.50% : FAIR_VALUE (Macro balanced equity valuation zone) - ERP > 2.50% : ATTRACTIVE_STOCKS (Equities undervalued / Attractive risk premium / Supportive for equity allocations) --- ### 18. OKUN MISERY INDEX - Purpose: Measures household welfare loss and stagflationary economic stress by summing the unemployment rate and headline annual inflation. - Data Series Keys: - BLS / FRED: UNRATE (Civilian Unemployment Rate) - BLS / FRED: CPIAUCSL (Consumer Price Index - YoY % Change) - Formula: Misery_Index = UNRATE + CPI_YoY - Machine-Executable Logic (Python): def misery_index(unrate, cpi_yoy): if any(v is None or isinstance(v, bool) for v in (unrate, cpi_yoy)): return None try: if not (math.isfinite(unrate) and math.isfinite(cpi_yoy)): return None # Unemployment rate cannot be negative if unrate < 0.0: return None score = round(unrate + cpi_yoy, 2) if not math.isfinite(score): return None if score >= 12.0: status = "ACUTE_CRISIS" elif score >= 10.0: status = "ELEVATED_STRESS" elif score >= 6.0: status = "MODERATE" else: status = "GOLDILOCKS" return {"misery_index": score, "status": status} except (TypeError, ValueError): return None - Interpretation: - Misery_Index > 12.0% : ACUTE_CRISIS (Severe welfare loss / Stagflationary shock threshold) - 10.0% to 12.0% : ELEVATED_STRESS (Elevated household and consumer pressure) - 6.0% to 10.0% : MODERATE (Manageable macroeconomic equilibrium) - Misery_Index < 6.0% : GOLDILOCKS (Low unemployment & stable prices) --- ### 19. BUFFETT INDICATOR (CORPORATE EQUITIES TO GDP) - Purpose: Measures asset valuation froth and overvaluation risk by comparing total corporate equity market value to nominal gross domestic product using official Fed Z.1 financial accounts. - Data Series Keys: - Official FRED Series: DDLS01USA156NWDB (Stock Market Capitalization to GDP for United States - Percent) - Component Benchmark: NCBEILQ027S (Nonfinancial Corporate Business: Corporate Equities; Liability - Level, Millions USD) - BEA / FRED: GDP (Gross Domestic Product - Nominal Billions of USD) - Formula: Buffett_Ratio_Pct = (Total_Equities_Market_Value_mil / (GDP_bil * 1000.0)) * 100 - Machine-Executable Logic (Python): def buffett_indicator(market_val, gdp_val): if any(v is None or isinstance(v, bool) for v in (market_val, gdp_val)): return None try: if not (math.isfinite(market_val) and math.isfinite(gdp_val)): return None # Market value and GDP must be strictly positive and finite numbers (zero and negative guard) if market_val <= 0.0 or gdp_val <= 0.0: return None gdp_mil = gdp_val * 1000.0 raw_ratio = (market_val / gdp_mil) * 100.0 if not math.isfinite(raw_ratio): return None ratio = round(raw_ratio, 2) if ratio >= 180.0: status = "SEVERELY_OVERVALUED" elif ratio >= 140.0: status = "OVERVALUED" elif ratio >= 100.0: status = "FAIR_VALUED" else: status = "UNDERVALUED" return {"buffett_ratio_pct": ratio, "status": status} except (TypeError, ValueError, ZeroDivisionError): return None - Interpretation: - Ratio >= 180.0% : SEVERELY_OVERVALUED (Critical bubble threshold / Sharp correction risk) - 140.0% to 180.0% : OVERVALUED (Market decoupled from real economy / Stretched valuation) - 100.0% to 140.0% : FAIR_VALUED (Balanced market valuation) - Ratio < 100.0% : UNDERVALUED (Equity market undervalued / Attractive entry territory) --- ### 22. HOUSEHOLD CREDIT STRESS GAUGE - Purpose: Measures consumer debt service vulnerability and consumption deceleration risk by evaluating credit card delinquency rates against the personal saving rate. - Data Series Keys: - FRED: DRCCLACBS (Delinquency Rate on Credit Card Loans, All Commercial Banks) - BEA / FRED: PSAVERT (Personal Saving Rate - % of Disposable Income) - Formula: Household_Stress_Ratio = DRCCLACBS / PSAVERT - Machine-Executable Logic (Python): def household_credit_stress(delinquency_rate, saving_rate): if any(v is None or isinstance(v, bool) for v in (delinquency_rate, saving_rate)): return None try: if not (math.isfinite(delinquency_rate) and math.isfinite(saving_rate)): return None # Delinquency rate cannot be negative if delinquency_rate < 0.0: return None # If saving rate is 0 or negative, household buffer is exhausted if saving_rate <= 0.0: return {"stress_ratio": None, "status": "SEVERE_CONSUMER_STRESS"} ratio = round(delinquency_rate / saving_rate, 3) if ratio >= 1.00: status = "SEVERE_CONSUMER_STRESS" elif ratio >= 0.50: status = "ELEVATED_PRESSURE" else: status = "HEALTHY_BALANCE_SHEET" return {"stress_ratio": ratio, "status": status} except (TypeError, ValueError, ZeroDivisionError): return None - Interpretation: - Ratio > 1.00 : SEVERE_CONSUMER_STRESS (Delinquencies exceed savings / Sudden brake on consumer spending and recession risk) - 0.50 to 1.00 : ELEVATED_PRESSURE (Depleting saving cushion / Rising debt repayment strain) - Ratio < 0.50 : HEALTHY_BALANCE_SHEET (Robust savings / Healthy consumer balance sheets) --- ### 23. OKUN GAP (GROWTH-EMPLOYMENT DIVERGENCE) - Purpose: Tests historical elasticity between real GDP growth and changes in unemployment to detect 'jobless growth' or latent labor market deterioration. - Data Series Keys: - BEA / FRED: GDPC1 (Real GDP - YoY % Change) - BLS / FRED: UNRATE (Civilian Unemployment Rate - YoY Change in Percentage Points) - Baseline Assumptions: - Potential Real GDP Growth: 2.0% - Okun Beta Coefficient: -0.5 - Formula: Expected_Unemployment_Delta = -0.5 * (Real_GDP_YoY - 2.0) Okun_Gap = Actual_Unemployment_Delta - Expected_Unemployment_Delta - Machine-Executable Logic (Python): def okun_labor_gap(actual_unrate_delta, real_gdp_yoy): if any(v is None or isinstance(v, bool) for v in (actual_unrate_delta, real_gdp_yoy)): return None try: if not (math.isfinite(actual_unrate_delta) and math.isfinite(real_gdp_yoy)): return None expected_delta = -0.5 * (real_gdp_yoy - 2.0) gap = round(actual_unrate_delta - expected_delta, 2) if gap >= 0.50: status = "JOBLESS_GROWTH_WARNING" elif gap <= -0.50: status = "LABOR_HOARDING" else: status = "BALANCED_OKUN_EQUILIBRIUM" return {"okun_gap": gap, "status": status} except (TypeError, ValueError): return None - Interpretation: - Okun_Gap > +0.50 : JOBLESS_GROWTH_WARNING (Unemployment rising despite growth / Productivity or structural disruption) - -0.50 to +0.50 : BALANCED_OKUN_EQUILIBRIUM (Growth and employment in historical balance) - Okun_Gap < -0.50 : LABOR_HOARDING (Firms retaining employees despite sluggish growth / Resilient employment) --- ### 23.1. LABOR MARKET DUAL-TRACK DYNAMICS - Purpose: Cross-evaluates nonfarm payrolls (PAYEMS), the unemployment rate, and civilian labor force participation (CIVPART) to model whether job creation absorbs population growth or signals recession risk. - Data Series Keys: - BLS / FRED: PAYEMS (All Employees, Total Nonfarm - Monthly Change in Thousands) - BLS / FRED: UNRATE (Civilian Unemployment Rate - Percent) - BLS / FRED: CIVPART (Labor Force Participation Rate - Percent) - Threshold Logic & Rules: - Breakeven Growth Band: 100k - 150k - Machine-Executable Logic (Python): def labor_dual_track_matrix(payems_mom, unrate_delta, civpart_delta): if any(v is None or isinstance(v, bool) for v in (payems_mom, unrate_delta, civpart_delta)): return None try: if not (math.isfinite(payems_mom) and math.isfinite(unrate_delta) and math.isfinite(civpart_delta)): return None p_mom = float(payems_mom) u_diff = round(float(unrate_delta), 2) c_diff = round(float(civpart_delta), 2) if p_mom > 150.0 and u_diff >= 0.0 and c_diff > 0.0: status = "BENIGN_SUPPLY_EXPANSION" elif p_mom < 100.0 and u_diff > 0.10: status = "RECESSION_EARLY_WARNING" else: status = "BALANCED_LABOR_MARKET" return {"payems_k": round(p_mom, 2), "status": status} except (TypeError, ValueError): return None - Interpretation: - status == BENIGN_SUPPLY_EXPANSION (PAYEMS_MoM > 150.0k, UNRATE_Delta >= 0.0, CIVPART_Delta > 0.0) : Unemployment steady/elevated due to rising participation (Healthy labor expansion) - status == RECESSION_EARLY_WARNING (PAYEMS_MoM < 100.0k, UNRATE_Delta > 0.10) : Job growth falls below population threshold while unemployment rises (Early recession warning) - status == BALANCED_LABOR_MARKET : Balanced labor market dynamics --- ### 23.2. TOTAL FUNDS FLOW AND VELOCITY MOMENTUM (TOTAL FUNDS FLOW) - Purpose: Models real and financial transaction liquidity volume, effective monetary flow, and asset inflation pressure by multiplying broad money supply (M2) by the velocity of money (M2V). (Note: As M2V is quarterly, M2SL observations must be aligned to quarterly frequency). - Execution Profile: On-Demand Tool Specification & Prompting Reference. Evaluated on quarterly intervals upon release of FRED M2V velocity telemetry. - Data Series Keys: - FRED: M2SL (M2 Money Supply - Billions of USD, Seasonally Adjusted) - FRED: M2V (Velocity of M2 Money Stock - Quarterly) - Formula: Total_Funds_Flow = M2SL * M2V - Machine-Executable Logic (Python): def total_funds_flow_model(m2_level, m2_velocity, prev_tff=None): if any(v is None or isinstance(v, bool) for v in (m2_level, m2_velocity)): return None try: if not (math.isfinite(m2_level) and math.isfinite(m2_velocity)): return None if m2_level <= 0.0 or m2_velocity <= 0.0: return None raw_tff = float(m2_level) * float(m2_velocity) if not math.isfinite(raw_tff): return None tff_val = round(raw_tff, 2) mom_change = None status = "BALANCED_LIQUIDITY_FLOW" if prev_tff is not None and not isinstance(prev_tff, bool) and math.isfinite(prev_tff) and prev_tff > 0: mom_change = round(((tff_val / float(prev_tff)) - 1.0) * 100.0, 2) if mom_change > 2.0: status = "EXCESS_VELOCITY_INFLATION" elif mom_change < 0.0: status = "LIQUIDITY_STAGNATION" return { "total_funds_flow": tff_val, "tff_qoq_pct": mom_change, "status": status } except (TypeError, ValueError, ZeroDivisionError): return None - Interpretation: - status == EXCESS_VELOCITY_INFLATION : Excessive Liquidity Acceleration & Asset Bubble Inflation Risk (TFF QoQ > 2.0%) - status == BALANCED_LIQUIDITY_FLOW : Balanced Liquidity Flow (0.0% <= TFF QoQ <= 2.0%) - status == LIQUIDITY_STAGNATION : Velocity Collapse, Liquidity Freeze & Deflationary Contraction Risk (TFF QoQ < 0.0%) --- ### 23.3. HOUSING AFFORDABILITY AND BUBBLE GAUGE - Purpose: Measures housing affordability and real estate bubble risks by dividing median home sales prices by average private hourly earnings to determine required labor hours per home. (Note: As MSPUS is quarterly, hourly earnings must be aligned to quarterly frequency). - Data Series Keys: - FRED: MSPUS (Median Sales Price of Houses Sold for the United States - Quarterly, USD) - BLS / FRED: CES0500000003 (Average Hourly Earnings of All Employees, Total Private - USD per Hour) - Formula: Affordability_Ratio_Hours = MSPUS / CES0500000003 - Machine-Executable Logic (Python): def housing_bubble_gauge(mspus, ahe): if any(v is None or isinstance(v, bool) for v in (mspus, ahe)): return None try: if not (math.isfinite(mspus) and math.isfinite(ahe)): return None if mspus <= 0.0 or ahe <= 0.0: return None raw_ratio = float(mspus) / float(ahe) if not math.isfinite(raw_ratio): return None ratio = round(raw_ratio, 2) if ratio > 13500.0: status = "SEVERE_HOUSING_BUBBLE" elif ratio > 11000.0: status = "ELEVATED_STRESS" else: status = "ACCESSIBLE_MARKET" return {"affordability_hours": ratio, "status": status} except (TypeError, ValueError, ZeroDivisionError): return None - Interpretation: - status == SEVERE_HOUSING_BUBBLE : Acute housing affordability crisis & bubble alarm (Ratio exceeds 13,500 hours) - status == ELEVATED_STRESS : Stretched housing costs and consumer affordability pressure (11,000 to 13,500 hours) - status == ACCESSIBLE_MARKET : Historical equilibrium and affordable housing market (Ratio below 11,000 hours) --- ### 23.4. EARLY LAYOFF AND RECESSION SIGNAL - Purpose: Detects latent employment losses and early recessionary inflection before official unemployment rises by measuring declining average weekly work hours (Total Private AWHAETP, with historical manufacturing series AWHMAN) alongside industrial production contraction. - Data Series Keys: - FRED: INDPRO (Industrial Production: Total Index - YoY Percent Change) - BLS / FRED: AWHAETP (Average Weekly Hours of All Employees, Total Private - YoY Percent Change) - Historical Alternative: AWHMAN (Average Weekly Hours of Production and Nonsupervisory Employees, Manufacturing) - Formula: Early_Layoff_Index = INDPRO_YoY + (AWHAETP_YoY * 2.0) - Machine-Executable Logic (Python): def early_layoff_signal(indpro_yoy, awhaetp_yoy): if any(v is None or isinstance(v, bool) for v in (indpro_yoy, awhaetp_yoy)): return None try: if not (math.isfinite(indpro_yoy) and math.isfinite(awhaetp_yoy)): return None raw_index = float(indpro_yoy) + (float(awhaetp_yoy) * 2.0) if not math.isfinite(raw_index): return None index = round(raw_index, 2) if index < -2.50: status = "ACUTE_LAYOFF_CONTRACTION" elif index < 0.0: status = "EARLY_RECESSION_SIGNAL" else: status = "EXPANSION_EMPLOYMENT_MOMENTUM" return {"early_layoff_index": index, "status": status} except (TypeError, ValueError): return None - Interpretation: - status == ACUTE_LAYOFF_CONTRACTION : Overtime cuts paired with industrial contraction (Early layoff wave & deep recession risk / Index < -2.50) - status == EARLY_RECESSION_SIGNAL : Production losing momentum and work hours softening (Latent unemployment onset / -2.50 to 0.0) - status == EXPANSION_EMPLOYMENT_MOMENTUM : Resilient industrial activity and robust work hours (Index >= 0.0) --- ### 23.5. REAL CONSUMPTION COLLAPSE RADAR - Purpose: Measures real household consumption volume by stripping inflation from nominal retail sales growth. A negative real print despite positive nominal sales exposes price illusion and underlying consumer demand contraction. - Data Series Keys: - FRED: RSAFS (Advance Retail Sales: Retail and Food Services, Total - YoY Percent Change) - FRED Alternative: RSXFS (Advance Retail Sales: Retail Trade Excluding Food Services) - BLS / FRED: CPIAUCSL (Consumer Price Index for All Urban Consumers: All Items - YoY Percent Change) - Formula: Real_Consumption_Growth = Retail_Sales_YoY - CPI_YoY - Machine-Executable Logic (Python): def real_consumption_collapse_radar(retail_yoy, cpi_yoy): if any(v is None or isinstance(v, bool) for v in (retail_yoy, cpi_yoy)): return None try: if not (math.isfinite(retail_yoy) and math.isfinite(cpi_yoy)): return None raw_growth = float(retail_yoy) - float(cpi_yoy) if not math.isfinite(raw_growth): return None growth = round(raw_growth, 2) if growth < -2.0: status = "SEVERE_REAL_CONTRACTION" elif growth < 0.0: status = "REAL_DEMAND_CONTRACTION" elif growth > 2.0: status = "STRONG_VOLUME_EXPANSION" else: status = "MODERATE_VOLUME_EXPANSION" return {"real_consumption_growth": growth, "status": status} except (TypeError, ValueError): return None - Interpretation: - status == SEVERE_REAL_CONTRACTION : Severe volume collapse & consumer stagnation (Real growth < -2.0%) - status == REAL_DEMAND_CONTRACTION : Price illusion and contracting retail sales volume (-2.0% to 0.0%) - status == MODERATE_VOLUME_EXPANSION : Balanced and healthy consumption growth (0.0% to 2.0%) - status == STRONG_VOLUME_EXPANSION : Robust consumer demand and volumetric growth acceleration (> 2.0%) --- ### 23.6. EARLY EMPLOYMENT CRACK SIGNAL - Purpose: Detects leading employment cracks by tracking weekly initial claims spikes when the headline unemployment rate (a lagging metric) appears benign. - Methodological Dual-Confirmation Rationale: Initial claims (ICSA/IC4WSA) serve as a high-frequency leading flow metric, while the civilian unemployment rate (UNRATE) is a lagging stock metric. The index subtracts 10x the positive unemployment rate change to isolate whether claims are surging independently before headline unemployment catches up. The joint requirement (claims_yoy >= 15% and crack_index > 15) establishes dual statistical confirmation, preventing temporary seasonal layoff noise from triggering false macroeconomic crisis alarms. - Data Series Keys: - FRED Benchmark: IC4WSA (4-Week Moving Average of Initial Claims - YoY Percent Change) - FRED Alternative: ICSA (Initial Claims - Weekly Level YoY Percent Change) - BLS / FRED: UNRATE (Civilian Unemployment Rate - YoY Change in Percentage Points) - Formula: Effective_Unrate_Delta = max(0.0, UNRATE_Delta) Early_Crack_Index = ICSA_YoY - (Effective_Unrate_Delta * 10.0) - Machine-Executable Logic (Python): def early_employment_crack(icsa_yoy, unrate_delta): if any(v is None or isinstance(v, bool) for v in (icsa_yoy, unrate_delta)): return None try: if not (math.isfinite(icsa_yoy) and math.isfinite(unrate_delta)): return None claims_yoy = float(icsa_yoy) u_delta = float(unrate_delta) # Prevent drops in unemployment rate from generating false stress signals effective_u_delta = max(0.0, u_delta) raw_index = claims_yoy - (effective_u_delta * 10.0) if not math.isfinite(raw_index): return None index = round(raw_index, 2) if claims_yoy >= 15.0 and index > 15.0: status = "HIDDEN_CRISIS_UNFOLDING" elif claims_yoy >= 8.0 and index > 5.0: status = "EARLY_WARNING_CRACK" else: status = "LABOR_MARKET_ALIGNED" return {"crack_index": index, "claims_yoy": claims_yoy, "status": status} except (TypeError, ValueError): return None - Interpretation: - status == HIDDEN_CRISIS_UNFOLDING : Weekly claims surging rapidly while official unemployment has not reacted (Latent recession onset / Claims growth >= 15.0% & Index >= 15.0) - status == EARLY_WARNING_CRACK : Initial cracks emerging in the labor market (Leading crack signal / Claims growth >= 8.0% & Index >= 5.0) - status == LABOR_MARKET_ALIGNED : Data balanced or official unemployment moving in lockstep with claims (Healthy employment path) --- ### 23.7. INVENTORY TO SALES GLUT RATIO - Purpose: Measures the ratio of total business inventories to monthly sales. When elevated, businesses curtail orders and cut production to liquidate stockpiles, precipitating an inventory-cycle recession. - Data Series Keys: - FRED: ISRATIO (Total Business: Inventories to Sales Ratio - Monthly, Seasonally Adjusted) - Component Inventories: BUSINV (Total Business Inventories - Millions USD) - Component Sales: TOTBUSSALES (Total Business Sales - Millions USD) - Formula: Inventory_Glut_Ratio = ISRATIO - Machine-Executable Logic (Python): def inventory_to_sales_glut(isratio): if isratio is None or isinstance(isratio, bool): return None try: if not math.isfinite(isratio): return None if isratio <= 0.0: return None ratio = round(float(isratio), 2) if ratio > 1.45: status = "SYSTEMIC_INVENTORY_GLUT" elif ratio < 1.28: status = "SUPPLY_SHOCK_SHORTAGE" else: status = "BALANCED_SUPPLY_CHAIN" return {"isratio": ratio, "status": status} except (TypeError, ValueError): return None - Interpretation: - status == SYSTEMIC_INVENTORY_GLUT : Excessive inventory stockpiling paired with demand deficiency; manufacturers will slash output and shifts (Inventory recession alarm / Ratio > 1.45) - status == BALANCED_SUPPLY_CHAIN : Production and retail sales in equilibrium (Healthy inventory turnover / 1.28 to 1.45) - status == SUPPLY_SHOCK_SHORTAGE : Inventory depletion and supply chain bottlenecking; empty shelves and cost-push inflation pressure (Ratio < 1.28) --- ### 23.8. MORTGAGE AND PERMIT DIVERGENCE (HOUSING FREEZE INDEX) - Purpose: Measures divergence between surging mortgage rates and builder permitting appetite to model housing supply constraints, market lock-in effects, and shelter inflation persistence. (Note: As MORTGAGE30US is weekly, monthly average must be aligned to PERMIT). - Methodological Scaling & Normalization Rationale: Building permit annual growth (PERMIT_YoY) exhibits an empirical standard deviation roughly an order of magnitude larger than nominal mortgage rate levels (e.g. ±20% to ±40% swings vs. 3% to 8% interest rates). Dividing PERMIT_YoY by 10.0 linearly normalizes its variance to match the unit magnitude of 30-year fixed mortgage rates, allowing a balanced composite spread without permits completely overwhelming interest rate dynamics. The 5.0 and 8.0 thresholds correspond empirically to historical median mortgage burdens and severe affordability contraction zones (such as post-1981 and 2022-2024 lock-in regimes). - Data Series Keys: - FRED: MORTGAGE30US (30-Year Fixed Rate Mortgage Average in the United States - Percent) - FRED: PERMIT (New Privately-Owned Housing Units Authorized - YoY Percent Change) - Formula: Housing_Freeze_Index = MORTGAGE30US - (PERMIT_YoY / 10.0) - Machine-Executable Logic (Python): def housing_freeze_index(mortgage_rate, permit_yoy): if any(v is None or isinstance(v, bool) for v in (mortgage_rate, permit_yoy)): return None try: if not (math.isfinite(mortgage_rate) and math.isfinite(permit_yoy)): return None if mortgage_rate <= 0.0: return None raw_index = float(mortgage_rate) - (float(permit_yoy) / 10.0) if not math.isfinite(raw_index): return None index = round(raw_index, 2) if index > 8.0: status = "SEVERE_HOUSING_FREEZE" elif index > 5.0: status = "SUPPLY_CONTRACTION" else: status = "HEALTHY_EXPANSION" return {"freeze_index": index, "status": status} except (TypeError, ValueError): return None - Interpretation: - status == SEVERE_HOUSING_FREEZE : Severe mortgage rate shock causing permit collapse; home construction frozen, acute supply crisis (Index > 8.0) - status == SUPPLY_CONTRACTION : High borrowing costs depressing builder activity; new housing supply contracting (Index 5.0 to 8.0) - status == HEALTHY_EXPANSION : Supportive financing conditions; healthy expansion in residential supply (Index <= 5.0) --- ### 25. TERMS OF TRADE (TOT) - Purpose: Measures sovereign purchasing power, terms-of-trade welfare transfers, and current account fragility by evaluating the ratio of export prices to import prices. - Data Series Keys: - BLS / FRED (Export Price Index): IQ (U.S. Export Price Index - All Commodities) - BLS / FRED (Import Price Index): IR (U.S. Import Price Index - All Commodities) - Formula: Terms_Of_Trade = (Export_Price_Index / Import_Price_Index) * 100.0 - Machine-Executable Logic (Python): def terms_of_trade_index(export_idx, import_idx): if any(v is None or isinstance(v, bool) for v in (export_idx, import_idx)): return None try: if export_idx <= 0.0 or import_idx <= 0.0: return None res = (export_idx / import_idx) * 100.0 return round(res, 2) if math.isfinite(res) else None except (TypeError, ValueError, ZeroDivisionError): return None - Interpretation: - TOT > 100.0 : FAVORABLE_TRADE (Export revenue purchasing power expanding / Positive terms of trade) - TOT == 100.0 : BASELINE_EQUILIBRIUM (Historical baseline equilibrium) - TOT < 100.0 : DETERIORATING_TERMS (Imported goods relatively more expensive / Real income loss & current account pressure) --- ### 25.2. STICKY VS. FLEXIBLE CPI SPREAD - Purpose: Evaluates structural core inflation persistence versus commodity-driven transient price shocks by measuring the spread between sticky CPI (services, shelter) and flexible CPI (fuel, food). - Data Series Keys: - FRED: STICKYCPIM157SFRBATL (Sticky Consumer Price Index less Food and Energy - YoY % Change) - FRED: FLEXCPIM157SFRBATL (Flexible Consumer Price Index less Food and Energy - YoY % Change) - Formula: Sticky_Impulse = Sticky_CPI_YoY - Flexible_CPI_YoY - Machine-Executable Logic (Python): def sticky_flexible_cpi_spread(sticky_cpi_yoy, flex_cpi_yoy): if any(v is None or isinstance(v, bool) for v in (sticky_cpi_yoy, flex_cpi_yoy)): return None try: f_sticky = float(sticky_cpi_yoy) f_flex = float(flex_cpi_yoy) if not (math.isfinite(f_sticky) and math.isfinite(f_flex)): return None raw_impulse = f_sticky - f_flex if not math.isfinite(raw_impulse): return None impulse = round(raw_impulse, 2) if impulse > 2.0: status = "STRUCTURAL_INFLATION_TRAP" elif impulse < -2.0: status = "TRANSITORY_INFLATION_SURGE" else: status = "BALANCED_DISINFLATION_PATH" return {"sticky_impulse": impulse, "status": status} except (TypeError, ValueError): return None - Interpretation: - Sticky_Impulse > 2.0% : STRUCTURAL_INFLATION_TRAP (Sticky inflation pressure / Shelter & services rigidity / Core inflation trap) - Sticky_Impulse < -2.0% : TRANSITORY_INFLATION_SURGE (Transient commodity/energy price surge / Flexible price spike) - -2.0% to 2.0% : BALANCED_DISINFLATION_PATH (Coherent and balanced disinflation trajectory) --- ### 25.10. SLOOS LENDING STANDARDS RECESSION GAUGE - Purpose: Tracks the net percentage of domestic US banks tightening lending standards on commercial and industrial (C&I) loans to detect credit channel freezing 6-9 months ahead of recessions. - Data Series Keys: - FRED: DRTSCIS (Net Percentage of Domestic Banks Tightening Standards for Commercial and Industrial Loans to Small Firms - Quarterly Percent) - Formula: Credit_Tightening_Net_Pct = DRTSCIS - Machine-Executable Logic (Python): def sloos_lending_tightness_gauge(drtscis_val): if drtscis_val is None or isinstance(drtscis_val, bool): return None try: val = float(drtscis_val) if not math.isfinite(val): return None tightness = round(val, 2) if tightness > 40.0: status = "ACUTE_CREDIT_CRUNCH_RECESSION_SIGNAL" elif tightness >= 20.0: status = "RESTRICTIVE_CREDIT_CONTRACTION" elif tightness <= -10.0: status = "AGGRESSIVE_CREDIT_EXPANSION" else: status = "NEUTRAL_CREDIT_CONDITIONS" return {"credit_tightening_net_pct": tightness, "status": status} except (TypeError, ValueError): return None - Interpretation: - Credit_Tightening_Net_Pct > 40.0% : ACUTE_CREDIT_CRUNCH_RECESSION_SIGNAL (Acute credit channel freeze / Historical recession benchmark / Liquidity crisis alarm) - 20.0% to 40.0% : RESTRICTIVE_CREDIT_CONTRACTION (Noticeable lending standards tightening / Business investment and hiring headwinds) - -10.0% to 20.0% : NEUTRAL_CREDIT_CONDITIONS (Balanced credit flow and standard bank lending appetite) - Credit_Tightening_Net_Pct < -10.0% : AGGRESSIVE_CREDIT_EXPANSION (Loose credit standards / Aggressive credit expansion / Asset bubble risk) --- ### 25.11. FULL-TIME VS. INVOLUNTARY PART-TIME CRACK GAUGE - Purpose: Detects hidden labor market fragility by comparing the annual surge in involuntary part-time workers against changes in full-time employment, exposing structural deterioration obscured by headline NFP figures. - Data Series Keys: - FRED: LNS12500000 (Employed, Usually Work Full Time - Monthly Level, in Thousands) - FRED: LNS12032194 (Employed, Part-Time for Economic Reasons - Monthly Level, in Thousands) - Formula: Part_Time_Econ_YoY_Pct = ((LNS12032194(t) / LNS12032194(t-12)) - 1) * 100 Full_Time_YoY_Pct = ((LNS12500000(t) / LNS12500000(t-12)) - 1) * 100 Crack_Spread = Part_Time_Econ_YoY_Pct - Full_Time_YoY_Pct - Machine-Executable Logic (Python): def hidden_employment_crack_gauge(part_time_econ_level_current, part_time_econ_level_yr_ago, full_time_level_current, full_time_level_yr_ago): if any(v is None or isinstance(v, bool) for v in (part_time_econ_level_current, part_time_econ_level_yr_ago, full_time_level_current, full_time_level_yr_ago)): return None try: pt_curr = float(part_time_econ_level_current) pt_yr = float(part_time_econ_level_yr_ago) ft_curr = float(full_time_level_current) ft_yr = float(full_time_level_yr_ago) if not all(math.isfinite(x) for x in (pt_curr, pt_yr, ft_curr, ft_yr)): return None if pt_yr <= 0 or ft_yr <= 0 or pt_curr < 0 or ft_curr < 0: return None pt_yoy = ((pt_curr / pt_yr) - 1.0) * 100.0 ft_yoy = ((ft_curr / ft_yr) - 1.0) * 100.0 raw_spread = pt_yoy - ft_yoy if not math.isfinite(raw_spread): return None spread = round(raw_spread, 2) pt_yoy_rounded = round(pt_yoy, 2) if spread > 30.0 and pt_yoy_rounded > 15.0: status = "ACUTE_LABOR_MARKET_FRACTURE_RECESSION" elif spread > 18.0: status = "STRUCTURAL_EMPLOYMENT_WEAKENING_SIGNAL" elif spread < -10.0: status = "ROBUST_FULL_TIME_EXPANSION" else: status = "STABLE_EMPLOYMENT_COMPOSITION" return {"crack_spread_pct": spread, "part_time_yoy_pct": pt_yoy_rounded, "status": status} except (TypeError, ValueError): return None - Interpretation: - Crack_Spread > 30.0% and Part_Time_YoY > 15.0% : ACUTE_LABOR_MARKET_FRACTURE_RECESSION (Acute labor market fracture / Companies replacing full-time with part-time staff / High-conviction recession signal) - Crack_Spread > 18.0% : STRUCTURAL_EMPLOYMENT_WEAKENING_SIGNAL (Structural labor softening / Emerging cracks obscured by headline data) - -10.0% to 18.0% : STABLE_EMPLOYMENT_COMPOSITION (Stable employment composition / No unusual labor market distortion) - Crack_Spread < -10.0% : ROBUST_FULL_TIME_EXPANSION (Robust full-time job creation / Resilient labor market) --- ### 25.13. LABOR MARKET MOMENTUM INDEX (LMMI / EMME) - Purpose: Couples the annual percentage growth of Nonfarm Payrolls (PAYEMS) with the annual percentage point change in the Civilian Unemployment Rate (UNRATE) to measure net momentum, structural deceleration, and employment slack pressure on the Federal Reserve monetary policy reaction function. > **Dimensionality & Metric Construction Note:** PAYEMS_YoY_Pct is expressed as percentage growth (% YoY), whereas UNRATE_YoY_Diff is expressed in raw percentage points (pp). While dimensionally heterogeneous, this standard macro differential directly captures the net spread between payroll hiring acceleration and headline labor slack deterioration. - Data Series Keys: - BLS / FRED: PAYEMS (All Employees, Total Nonfarm - Monthly Level, in Thousands) - BLS / FRED: UNRATE (Civilian Unemployment Rate - Monthly Percent, %) - Formula: PAYEMS_YoY_Pct = ((PAYEMS(t) / PAYEMS(t-12)) - 1.0) * 100.0 # Unit: % UNRATE_YoY_Diff = UNRATE(t) - UNRATE(t-12) # Unit: percentage points (pp) LMMI = PAYEMS_YoY_Pct - UNRATE_YoY_Diff # Composite Momentum Spread Employment_Strength_Ratio = PAYEMS_YoY_Pct * (1.0 / UNRATE(t)) - Machine-Executable Logic (Python): def labor_market_momentum_index(payems_current, payems_yr_ago, unrate_current, unrate_yr_ago, prev_lmmi=None): if any(v is None or isinstance(v, bool) for v in (payems_current, payems_yr_ago, unrate_current, unrate_yr_ago)): return None try: p_curr = float(payems_current) p_yr = float(payems_yr_ago) u_curr = float(unrate_current) u_yr = float(unrate_yr_ago) if not all(math.isfinite(x) for x in (p_curr, p_yr, u_curr, u_yr)): return None if p_curr <= 0.0 or p_yr <= 0.0 or u_curr <= 0.0 or u_yr < 0.0: return None p_growth = ((p_curr / p_yr) - 1.0) * 100.0 u_diff = u_curr - u_yr raw_lmmi = p_growth - u_diff if not math.isfinite(raw_lmmi): return None lmmi = round(raw_lmmi, 2) p_growth_r = round(p_growth, 2) u_diff_r = round(u_diff, 2) strength_ratio = round(p_growth * (1.0 / u_curr), 2) if u_curr > 0 else None # Dynamic momentum direction check if historical LMMI benchmark is provided if prev_lmmi is not None and not isinstance(prev_lmmi, bool): p_lmmi = float(prev_lmmi) if math.isfinite(p_lmmi): if lmmi > 0.20: status = "DECELERATING_LABOR_MOMENTUM" if lmmi < p_lmmi else "STRONG_LABOR_EXPANSION" elif lmmi < -0.20: status = "LABOR_MARKET_DETERIORATION_RISK" else: status = "BALANCED_LABOR_MARKET" else: return None else: if lmmi > 1.00: status = "STRONG_LABOR_EXPANSION" elif lmmi > 0.20: status = "MODERATE_LABOR_EXPANSION" elif lmmi < -0.20: status = "LABOR_MARKET_DETERIORATION_RISK" else: status = "BALANCED_LABOR_MARKET" return { "lmmi_score": lmmi, "payems_yoy_pct": p_growth_r, "unrate_yoy_diff": u_diff_r, "employment_strength_ratio": strength_ratio, "status": status } except (TypeError, ValueError): return None - Interpretation: - LMMI > +1.00 (or rising): STRONG_LABOR_EXPANSION (Robust payroll expansion and declining/stable unemployment; accelerating labor market strength; lowers dovish Fed cut urgency) - +0.20 < LMMI <= +1.00 (or declining vs previous month): DECELERATING_LABOR_MOMENTUM / MODERATE_LABOR_EXPANSION (Employment expanding but losing velocity or unemployment ticking higher; late-cycle cooling) - -0.20 <= LMMI <= +0.20: BALANCED_LABOR_MARKET (Neutral labor signals; payroll creation roughly in line with labor force demographics) - LMMI < -0.20: LABOR_MARKET_DETERIORATION_RISK (Weakening payroll growth and rising unemployment; recessionary cracks widening) --- ### 25.27. INCOME-CONSUMPTION-CREDIT WALL MODEL (INCOME_CONSUMPTION_CREDIT_WALL) - Purpose: Measures whether US household consumption is organically supported by real disposable income or artificially sustained by drawing down savings and expanding consumer credit. - Target: llms-models.json -> MODEL_25.27 - Frequency: Monthly (BEA Real Income/PCE/Saving Rate + Federal Reserve G.19 Consumer Credit) - Canonical Input Series: - IND_PCEC96 : Real Personal Consumption Expenditures (YoY %) - IND_DSPIC96 : Real Disposable Personal Income (YoY %) - IND_PSAVERT : Personal Saving Rate (% of Disposable Personal Income) - IND_TOTALSL : Total Consumer Credit Owned and Securitized (YoY %) - Mathematical Formulation: 1. Consumption_Income_Gap_ppt = PCEC96_YoY - DSPIC96_YoY 2. Credit_Income_Leverage_ppt = TOTALSL_YoY - DSPIC96_YoY 3. Saving_Cushion_pct = PSAVERT - Temporal Integrity: - Every input must provide a valid ISO YYYY-MM-DD observation date and canonical source frequency. - All canonical inputs for this model are monthly; an October/September publication-date difference is explicit in observation_dates but does not set asynchronous_frequencies=true. - Machine-Executable Logic (Python): def calculate_income_consumption_credit_wall(pcec96_yoy, dspic96_yoy, psavert, totalsl_yoy, observation_dates=None, observation_frequencies=None): vals = (pcec96_yoy, dspic96_yoy, psavert, totalsl_yoy) if any(v is None or isinstance(v, bool) for v in vals): return None try: pce_yoy, inc_yoy, sav_pct, cred_yoy = [float(x) for x in vals] if not all(math.isfinite(x) for x in (pce_yoy, inc_yoy, sav_pct, cred_yoy)): return None if sav_pct < 0.0 or sav_pct > 50.0: return None if any(g < -50.0 or g > 100.0 for g in (pce_yoy, inc_yoy, cred_yoy)): return None gap_ppt = round(pce_yoy - inc_yoy, 4) credit_leverage_ppt = round(cred_yoy - inc_yoy, 4) if pce_yoy <= 0.0 and inc_yoy <= 0.0: status = "CONSUMER_RECESSION_WALL" elif gap_ppt >= 0.5 and sav_pct <= 3.5 and credit_leverage_ppt >= 1.0: status = "CREDIT_FUELED_WALL" elif gap_ppt >= 0.5 and (sav_pct <= 4.5 or credit_leverage_ppt >= 1.0): status = "SAVINGS_CREDIT_STRAIN" elif inc_yoy > pce_yoy and sav_pct > 4.5: status = "ORGANIC_INCOME_BUFFER" else: status = "BALANCED_HOUSEHOLD_DEMAND" return { "model_id": "MODEL_25.27", "consumption_income_gap_ppt": gap_ppt, "credit_income_leverage_ppt": credit_leverage_ppt, "saving_cushion_pct": round(sav_pct, 4), "status": status } except (TypeError, ValueError, ZeroDivisionError, OverflowError): return None - Interpretation: - PCEC96_YoY <= 0.0% & DSPIC96_YoY <= 0.0% : CONSUMER_RECESSION_WALL (Both real income and real consumption contracting) - Gap >= 0.5 & PSAVERT <= 3.5% & Credit_Leverage >= 1.0 : CREDIT_FUELED_WALL (Consumption outpacing real income via depleted savings and credit leverage) - Gap >= 0.5 & (PSAVERT <= 4.5% or Credit_Leverage >= 1.0) : SAVINGS_CREDIT_STRAIN (Consumption outpacing real income with thin saving buffer or elevated credit growth) - DSPIC96_YoY > PCEC96_YoY & PSAVERT > 4.5% : ORGANIC_INCOME_BUFFER (Real income growth exceeds consumption with healthy saving cushion) - Otherwise : BALANCED_HOUSEHOLD_DEMAND (Real income, consumption, and consumer credit broadly aligned) --- ### 25.34. ISRAEL EXTERNAL TRADE & HI-TECH CUSHION (ISRAEL_HITECH_TRADE_CUSHION) - Purpose: Measures whether Israel's monthly hi-tech services exports (BOI_HITECH_SVC_EX_USD) structurally cover its monthly merchandise trade deficit (BOI_TRADE_DEFICIT_USD) and isolates the share of the goods deficit driven by mineral fuel imports (BOI_MINERAL_FUEL_IM_USD), without artificial composite weights. - Target: llms-models.json -> MODEL_25.34 - Frequency: Monthly (Bank of Israel External Sector & Merchandise Trade Statistics, Million USD) - Canonical Input Series: - IND_BOI_HITECH_SVC_EX_USD : Israel Hi-Tech Services Exports (BOI, Monthly, Million USD) - IND_BOI_TRADE_DEFICIT_USD : Israel Merchandise Trade Balance Deficit (BOI, Monthly, Million USD) - IND_BOI_MINERAL_FUEL_IM_USD : Israel Mineral Fuel Imports (BOI, Monthly, Million USD) - Mathematical Formulation: 1. HiTech_Coverage_Ratio = BOI_HITECH_SVC_EX_USD / BOI_TRADE_DEFICIT_USD 2. Net_HiTech_Trade_Balance_USD = BOI_HITECH_SVC_EX_USD - BOI_TRADE_DEFICIT_USD 3. Fuel_Share_of_Deficit_Pct = (BOI_MINERAL_FUEL_IM_USD / BOI_TRADE_DEFICIT_USD) * 100.0 4. Non_Fuel_Trade_Deficit_USD = BOI_TRADE_DEFICIT_USD - BOI_MINERAL_FUEL_IM_USD - Temporal Integrity: - Every input must provide a valid ISO YYYY-MM-DD observation date (monthly BOI YYYY-MM dates are normalized to YYYY-MM-01) and canonical source frequency keyed exactly by BOI_HITECH_SVC_EX_USD, BOI_TRADE_DEFICIT_USD, and BOI_MINERAL_FUEL_IM_USD. - The calculation fails closed when either metadata map is incomplete, malformed, has extra keys, or is supplied without its paired map. - All three canonical inputs are Monthly; differing release months (e.g., services exports lagging goods trade by 1-2 months) are preserved explicitly in observation_dates while asynchronous_frequencies remains false. - Machine-Executable Logic (Python): def calculate_israel_hitech_trade_cushion( il_hitech_svc_ex_usd, il_trade_deficit_usd, il_mineral_fuel_im_usd, observation_dates=None, observation_frequencies=None, ): vals = (il_hitech_svc_ex_usd, il_trade_deficit_usd, il_mineral_fuel_im_usd) if any(isinstance(v, bool) or not isinstance(v, (int, float)) for v in vals): return None # Temporal metadata validation (exact 3 keys; fail-closed on missing/extra/malformed/unpaired) try: hitech_ex = float(il_hitech_svc_ex_usd) trade_def = float(il_trade_deficit_usd) fuel_im = float(il_mineral_fuel_im_usd) if not all(math.isfinite(x) for x in (hitech_ex, trade_def, fuel_im)): return None if not (0.0 < hitech_ex <= 50000.0 and 0.0 < trade_def <= 50000.0 and 0.0 <= fuel_im <= 50000.0): return None raw_coverage_ratio = hitech_ex / trade_def raw_net_balance_usd = hitech_ex - trade_def raw_fuel_share_pct = (fuel_im / trade_def) * 100.0 raw_non_fuel_deficit_usd = trade_def - fuel_im if raw_coverage_ratio < 1.0: status = "EXTERNAL_CUSHION_BREACHED" elif raw_coverage_ratio < 1.35 and raw_fuel_share_pct >= 25.0: status = "FUEL_DRIVEN_CUSHION_STRAIN" elif raw_coverage_ratio < 1.35: status = "THIN_HITECH_CUSHION" elif raw_fuel_share_pct >= 25.0: status = "ROBUST_HITECH_CUSHION_FUEL_PRESSURE" else: status = "ROBUST_HITECH_CUSHION" coverage_ratio = round(raw_coverage_ratio, 4) net_balance_usd = round(raw_net_balance_usd, 2) fuel_share_pct = round(raw_fuel_share_pct, 2) non_fuel_deficit_usd = round(raw_non_fuel_deficit_usd, 2) inputs_payload = { "il_hitech_svc_ex_usd_mil": round(hitech_ex, 3), "il_trade_deficit_usd_mil": round(trade_def, 3), "il_mineral_fuel_im_usd_mil": round(fuel_im, 3), } # When observation_dates & observation_frequencies are provided: # inputs_payload["observation_dates"] = validated_dates # inputs_payload["observation_frequencies"] = validated_frequencies # inputs_payload["asynchronous_frequencies"] = len(set(validated_frequencies.values())) > 1 return { "model_id": "MODEL_25.34", "model_name": "Israel External Trade & Hi-Tech Cushion", "formula_ref": "https://analysisreports.github.io/llms-formulas-macro-labor.txt#25.34", "primary_value": coverage_ratio, "unit": "Coverage Ratio (x)", "status": status, "inputs": inputs_payload, "components": { "hitech_coverage_ratio": coverage_ratio, "net_hitech_trade_balance_usd_mil": net_balance_usd, "fuel_share_of_deficit_pct": fuel_share_pct, "non_fuel_trade_deficit_usd_mil": non_fuel_deficit_usd, }, "metrics": { "hitech_coverage_ratio": coverage_ratio, "net_hitech_trade_balance_usd_mil": net_balance_usd, "fuel_share_of_deficit_pct": fuel_share_pct, "non_fuel_trade_deficit_usd_mil": non_fuel_deficit_usd, }, "interpretation": "Israel external trade & hi-tech cushion...", } except (TypeError, ValueError, ZeroDivisionError, OverflowError): return None - Interpretation: - HiTech_Coverage_Ratio < 1.00x : EXTERNAL_CUSHION_BREACHED (Hi-Tech services exports no longer cover the merchandise trade deficit) - 1.00x <= HiTech_Coverage_Ratio < 1.35x & Fuel_Share_of_Deficit_Pct >= 25.0% : FUEL_DRIVEN_CUSHION_STRAIN (Thinning hi-tech trade cushion with mineral fuel imports driving >= 25.0% of the goods deficit) - 1.00x <= HiTech_Coverage_Ratio < 1.35x : THIN_HITECH_CUSHION (Narrow external buffer with hi-tech services exports only marginally exceeding goods deficit) - HiTech_Coverage_Ratio >= 1.35x & Fuel_Share_of_Deficit_Pct >= 25.0% : ROBUST_HITECH_CUSHION_FUEL_PRESSURE (Strong hi-tech export buffer absorbing elevated mineral fuel import drag) - Otherwise : ROBUST_HITECH_CUSHION (Hi-Tech services exports comfortably covering the merchandise trade deficit with contained fuel-import drag)