Skill 寫法圖鑑

algo-risk-altman-z

asgard-ai-platform | 金融與投資 | 原文 | MIT

用 Altman Z-Score 從財務比率預測企業破產風險

中文翻譯

---
name: "algo-risk-altman-z"
description: "計算 Altman Z-Score,從財務比率預測企業破產機率。當使用者需要評估公司的財務困境風險、篩選容易破產的公司、或評估信用狀況時使用,即使他們說的是「破產預測」、「財務困境分數」或「Z-score 分析」也一樣。"
metadata:
  category: "WP-40 風險演算法"
  tags: ["risk", "altman-z-score", "bankruptcy", "financial-analysis"]
---

# Altman Z-Score

## 概述

Altman Z-Score 是線性判別模型,用五個財務比率預測破產機率。Z = 1.2X₁ + 1.4X₂ + 3.3X₃ + 0.6X₄ + 1.0X₅。分區:Z > 2.99(安全)、1.81-2.99(灰色地帶)、Z < 1.81(困境)。原本是給上市製造業公司用的;另有適用於未上市公司和非製造業的變體。

## 何時使用

**觸發條件:**
- 要篩選公司的破產風險
- 用公開的財報資料做快速的信用評估
- 要監控投資組合公司有沒有財務困境的訊號

**何時不要用:**
- 金融機構(銀行、保險公司),資本結構不同
- 需要詳細的信用評分時(用羅吉斯迴歸的信用模型)

## 演算法

```
鐵律:Z-Score 是針對「上市製造業」公司校準的
把原始公式套用在未上市公司、服務業或新興市場,
卻「沒有」使用適當的變體,會產生誤導的結果。
未上市公司用 Z'-Score,非製造業和新興市場用 Z''-Score。
```

### 階段 1:輸入驗證
從財報擷取:營運資金、保留盈餘、EBIT、市值(未上市公司則用帳面權益)、總資產、總負債、銷售額。
**關卡:** 五個輸入都齊全,且來自同一個報告期間。

### 階段 1.5:變體選擇(必做)

動任何公式之前,先挑對變體,這是套用 Altman Z 時最常見的單一錯誤。

| 公司描述 | 變體 | 腳本參數 |
|------------------|---------|-------------|
| 上市**製造業**公司 | 原始 Z | `--variant original` |
| **未上市**製造業公司(沒有市值) | Z' | `--variant private` |
| **非製造業**,包含 SaaS、服務、零售、科技、輕金融 | Z'' | `--variant non_manufacturing` |
| 任何類型的新興市場公司 | Z'' | `--variant non_manufacturing` |

**如果使用者的描述裡包含以下任何標籤**:「SaaS」、「cloud」、「software」、「services」、「retail」、「e-commerce」、「platform」、「tech」、「emerging market」、「BRICS」、「non-manufacturing」→ **用 Z''**。不要因為原始 Z 是「經典」公式,就預設用它。

每個變體完整的公式和分區門檻,放在 [`references/z-score-variants.md`](references/z-score-variants.md)。係數、X₄ 的定義(市值 vs 帳面權益)以及 X₅ 的處理方式,在各變體之間都不一樣,它們不是對原始公式的小幅調整。

### 階段 2:核心演算法
1. X₁ = 營運資金 / 總資產(流動性)
2. X₂ = 保留盈餘 / 總資產(累積獲利能力)
3. X₃ = EBIT / 總資產(營運效率)
4. X₄ = 權益市值 / 總負債(槓桿)
5. X₅ = 銷售額 / 總資產(資產週轉率)
6. Z = 1.2X₁ + 1.4X₂ + 3.3X₃ + 0.6X₄ + 1.0X₅

### 階段 3:驗證
檢查:所有比率都在合理範圍內。把 Z-score 和同業及歷史趨勢做比較。
**關卡:** Z-score 已算出、已歸入分區。

### 階段 4:輸出
回傳 Z-score,附上各成分的拆解和分區。

## 輸出格式

```json
{
  "z_score": 2.45,
  "zone": "grey",
  "components": {"X1": 0.12, "X2": 0.25, "X3": 0.08, "X4": 1.5, "X5": 0.9},
  "metadata": {"model": "original", "company": "...", "period": "2024-Q4"}
}
```

## 範例

### 輸入輸出範例
**輸入:** WC=200M, RE=500M, EBIT=150M, MktCap=2B, TL=1B, TA=3B, Sales=2.5B
**預期:** X1=0.067, X2=0.167, X3=0.05, X4=2.0, X5=0.833。Z=1.2(0.067)+1.4(0.167)+3.3(0.05)+0.6(2.0)+1.0(0.833)=2.53 → 灰色地帶。

### 邊界情況
| 輸入 | 預期 | 原因 |
|-------|----------|-----|
| 保留盈餘為負 | X₂ 低,很可能是困境 | 累積虧損是強烈的困境訊號 |
| 沒有營收的新創 | X₅ 接近零 | Z-score 不是為還沒有營收的公司設計的 |
| 輕資產的科技公司 | X₅ 有誤導性 | 高營收/低資產會墊高週轉率 |

## 常見陷阱

- **模型年代久遠**:1968 年用 1946-1965 年的資料校準。商業模式、會計準則和資本結構都已改變。只能當作一個訊號,不能是唯一的決定依據。
- **會計操弄**:Z-score 用的是帳上的財報。創意會計(表外負債、玩弄收入認列)可能掩蓋困境。
- **產業差異**:資本密集的產業,資產週轉率(X₅)天生就比較低。要在同產業內比較,不要跨產業。
- **趨勢比水準更重要**:一家公司兩年內從 Z=3.5 掉到 Z=2.1,就算 2.1 仍在灰色地帶,還是令人擔憂。
- **未上市公司變體**(Z'):把 X₄ 換成帳面權益 / 總負債,並重新配權重:`Z' = 0.717X₁ + 0.847X₂ + 3.107X₃ + 0.420X₄ + 0.998X₅`。分區門檻改為 2.9 / 1.23。
- **非製造業變體**(Z''):**完全拿掉 X₅**,並重新估計其餘係數:`Z'' = 6.56X₁ + 3.26X₂ + 6.72X₃ + 1.05X₄`。分區門檻改為 2.6 / 1.1。對 SaaS/服務業公司用原始 Z,會透過 X₅ 墊高分數,可能把陷入困境的公司誤判為安全。

## 腳本

| 腳本 | 說明 | 用法 |
|--------|-------------|-------|
| `scripts/altman_z.py` | 計算 Altman Z-Score 並歸入分區 | `python scripts/altman_z.py --help` |

執行 `python scripts/altman_z.py --verify` 可以跑內建的健全性測試。

## 參考資料

- [`references/z-score-variants.md`](references/z-score-variants.md):Z / Z' / Z'' 的完整公式、分區門檻、變體選擇規則,以及一個科技公司的實算範例。

英文原文

---
name: "algo-risk-altman-z"
description: "Calculate Altman Z-Score to predict corporate bankruptcy probability from financial ratios. Use this skill when the user needs to assess a company's financial distress risk, screen for bankruptcy-prone firms, or evaluate credit worthiness — even if they say 'bankruptcy prediction', 'financial distress score', or 'Z-score analysis'."
metadata:
  category: "WP-40 風險演算法"
  tags: ["risk", "altman-z-score", "bankruptcy", "financial-analysis"]
---

# Altman Z-Score

## Overview

Altman Z-Score is a linear discriminant model predicting bankruptcy probability from five financial ratios. Z = 1.2X₁ + 1.4X₂ + 3.3X₃ + 0.6X₄ + 1.0X₅. Zones: Z > 2.99 (safe), 1.81-2.99 (grey), Z < 1.81 (distress). Originally for public manufacturing firms; variants exist for private and non-manufacturing.

## When to Use

**Trigger conditions:**
- Screening companies for bankruptcy risk
- Quick credit assessment using publicly available financials
- Monitoring portfolio companies for financial distress signals

**When NOT to use:**
- For financial institutions (banks, insurers) — different capital structures
- When detailed credit scoring is needed (use logistic regression credit models)

## Algorithm

```
IRON LAW: Z-Score Was Calibrated for PUBLIC MANUFACTURING Firms
Applying the original formula to private firms, service companies, or
emerging markets WITHOUT using the appropriate variant produces
misleading results. Use Z'-Score for private firms, Z''-Score for
non-manufacturing and emerging markets.
```

### Phase 1: Input Validation
Extract from financial statements: working capital, retained earnings, EBIT, market cap (or book equity for private), total assets, total liabilities, sales.
**Gate:** All five inputs available, from same reporting period.

### Phase 1.5: Variant Selection (MANDATORY)

Before touching any formula, pick the right variant — this is the single most common
mistake when applying Altman Z.

| Firm description | Variant | Script flag |
|------------------|---------|-------------|
| Public **manufacturing** firm | Original Z | `--variant original` |
| **Private** manufacturing firm (no market cap) | Z' | `--variant private` |
| **Non-manufacturing** — SaaS, services, retail, tech, finance-light | Z'' | `--variant non_manufacturing` |
| Emerging-market firm of any kind | Z'' | `--variant non_manufacturing` |

**If the user description contains any of these tags**: "SaaS", "cloud", "software",
"services", "retail", "e-commerce", "platform", "tech", "emerging market", "BRICS",
"non-manufacturing" → **use Z''**. Do not default to the original Z just because
that's the "classic" formula.

Full formulas and zone thresholds for each variant live in
[`references/z-score-variants.md`](references/z-score-variants.md). Coefficients,
X₄ definition (market cap vs book equity), and the X₅ treatment all differ between
variants — they are not small tweaks to the original.

### Phase 2: Core Algorithm
1. X₁ = Working Capital / Total Assets (liquidity)
2. X₂ = Retained Earnings / Total Assets (cumulative profitability)
3. X₃ = EBIT / Total Assets (operating efficiency)
4. X₄ = Market Value of Equity / Total Liabilities (leverage)
5. X₅ = Sales / Total Assets (asset turnover)
6. Z = 1.2X₁ + 1.4X₂ + 3.3X₃ + 0.6X₄ + 1.0X₅

### Phase 3: Verification
Check: all ratios in plausible ranges. Compare Z-score against industry peers and historical trend.
**Gate:** Z-score computed, zone classification assigned.

### Phase 4: Output
Return Z-score with component breakdown and zone classification.

## Output Format

```json
{
  "z_score": 2.45,
  "zone": "grey",
  "components": {"X1": 0.12, "X2": 0.25, "X3": 0.08, "X4": 1.5, "X5": 0.9},
  "metadata": {"model": "original", "company": "...", "period": "2024-Q4"}
}
```

## Examples

### Sample I/O
**Input:** WC=200M, RE=500M, EBIT=150M, MktCap=2B, TL=1B, TA=3B, Sales=2.5B
**Expected:** X1=0.067, X2=0.167, X3=0.05, X4=2.0, X5=0.833. Z=1.2(0.067)+1.4(0.167)+3.3(0.05)+0.6(2.0)+1.0(0.833)=2.53 → Grey zone.

### Edge Cases
| Input | Expected | Why |
|-------|----------|-----|
| Negative retained earnings | Low X₂, likely distress | Accumulated losses are a strong distress signal |
| Startup with no revenue | X₅ near zero | Z-score not designed for pre-revenue companies |
| Asset-light tech firm | Misleading X₅ | High revenue/low assets inflates turnover |

## Gotchas

- **Model age**: Calibrated in 1968 on 1946-1965 data. Business models, accounting standards, and capital structures have changed. Use as one signal, not sole determinant.
- **Accounting manipulation**: Z-score uses reported financials. Creative accounting (off-balance-sheet debt, revenue recognition games) can mask distress.
- **Industry differences**: Capital-intensive industries naturally have lower asset turnover (X₅). Compare within industry, not across.
- **Trend matters more than level**: A company moving from Z=3.5 to Z=2.1 over two years is concerning even though 2.1 is still in the grey zone.
- **Private firm variant** (Z'): replaces X₄ with Book Equity / Total Liabilities and re-weights: `Z' = 0.717X₁ + 0.847X₂ + 3.107X₃ + 0.420X₄ + 0.998X₅`. Zone thresholds shift to 2.9 / 1.23.
- **Non-manufacturing variant** (Z''): **drops X₅ entirely** and re-estimates the rest: `Z'' = 6.56X₁ + 3.26X₂ + 6.72X₃ + 1.05X₄`. Zone thresholds shift to 2.6 / 1.1. Using original Z on a SaaS / services firm inflates the score via X₅ and can mis-zone a distressed firm as safe.

## Scripts

| Script | Description | Usage |
|--------|-------------|-------|
| `scripts/altman_z.py` | Compute Altman Z-Score and classify zone | `python scripts/altman_z.py --help` |

Run `python scripts/altman_z.py --verify` to execute built-in sanity tests.

## References

- [`references/z-score-variants.md`](references/z-score-variants.md) — Z / Z' / Z'' full
  formulas, zone thresholds, variant-selection rules, and a worked tech-firm example.