Accounting scoring models
Original Altman Z with historical bands, eight-variable Beneish M, and Piotroski F with components.
- Model id
accounting.scoring_models, version 1- Domain
- Accounting
- Evidence
- practitioner
- Cost class
- instant: A closed-form calculation; a hosted run may take up to 2 seconds.
Formula
Where
- Altman's Z-score
z_score - Working capital over total assets
working_capital_to_assets - Retained earnings over total assets
retained_earnings_to_assets - EBIT over total assets
ebit_to_assets - Market value of equity over book total liabilities
market_equity_to_liabilities - Sales over total assets
sales_to_assets - Beneish's M-score
m_score - Days' sales in receivables index
dsri - Gross margin index
gmi - Asset quality index
aqi - Sales growth index
sgi - Depreciation index
depi - Selling, general and administrative expenses index
sgai - Total accruals over total assets
tata - Leverage index
lvgi - Piotroski's F-score
f_score - The j-th of the nine signals: 1 when it holds, 0 when it does not
Each symbol's field is named beside it; the inputs and outputs, with their units and bounds, are under Variables, and the citations give each formula's source.
Variables
Rates, returns and yields are decimals: 0.05 is five percent. Bounds in brackets include their end; in parentheses they exclude it.
Inputs
Original public manufacturing Z-score (altman_z): 6 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Original public manufacturing Z-score | |
Working capital to assetsworking_capital_to_assetsratio · [-100, 100] | ratio | [-100, 100] | Working capital / total assets, decimal ratio |
Retained earnings to assetsretained_earnings_to_assetsratio · [-100, 100] | ratio | [-100, 100] | Retained earnings / total assets, decimal ratio |
EBIT to assetsebit_to_assetsratio · [-100, 100] | ratio | [-100, 100] | EBIT / total assets, decimal ratio |
Market equity to liabilitiesmarket_equity_to_liabilitiesratio · [0, 100] | ratio | [0, 100] | Market common and preferred equity / book total liabilities |
Sales to assetssales_to_assetsratio · [0, 100] | ratio | [0, 100] | Sales / total assets, unscaled turnover |
Eight-variable M-score (beneish_m): 9 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Eight-variable M-score | |
DSRIdsriratio · [0, 100] | ratio | [0, 100] | (Receivables/sales)t / (receivables/sales)t-1 |
GMIgmiratio · [0, 100] | ratio | [0, 100] | Gross margin t-1 / gross margin t |
AQIaqiratio · [0, 100] | ratio | [0, 100] | [1-(current assets+PPE)/assets]t / same t-1 |
SGIsgiratio · [0, 100] | ratio | [0, 100] | Sales t / sales t-1 |
DEPIdepiratio · [0, 100] | ratio | [0, 100] | [Depreciation/(depreciation+PPE)]t-1 / same t |
SGAIsgairatio · [0, 100] | ratio | [0, 100] | (SG&A/sales)t / (SG&A/sales)t-1 |
TATAtataratio · [-100, 100] | ratio | [-100, 100] | (Change in current assets - change in cash - change in current liabilities + change in current maturities of long-term debt + change in income-tax payable - depreciation and amortization) / total assets |
LVGIlvgiratio · [0, 100] | ratio | [0, 100] | [(Current liabilities+long-term debt)/assets]t / same t-1 |
Nine original binary signals (piotroski_f): 10 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Nine original binary signals | |
Positive ROApositive_roaflag | flag | Net income before extraordinary items / beginning assets > 0 | |
Positive CFOpositive_cfoflag | flag | Operating cash flow / beginning assets > 0 | |
Improving ROAimproving_roaflag | flag | Current ROA exceeds prior ROA; each scaled by its beginning assets | |
Cash exceeds incomecash_exceeds_incomeflag | flag | CFO / beginning assets exceeds ROA, strictly | |
Decreasing leveragedecreasing_leverageflag | flag | Long-term debt including its current portion / average assets decreased, strictly | |
Improving liquidityimproving_liquidityflag | flag | Current assets / current liabilities increased, strictly | |
No equity issuanceno_equity_issuanceflag | flag | No common equity issued during the preceding year | |
Improving marginimproving_marginflag | flag | Gross margin increased, strictly | |
Improving turnoverimproving_turnoverflag | flag | Sales / beginning assets increased, strictly |
Outputs
Original public manufacturing Z-score (altman_z): 8 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Original public manufacturing Z-score | |
Z scorez_scoreratio · [-1000, 1000] | ratio | [-1000, 1000] | Original discriminant score, using .999 sales coefficient |
Zonezonetext | text | Historical bands: below 1.81, 1.81 through 2.99, above 2.99 | |
Working capital componentworking_capital_componentratio · [-120, 120] | ratio | [-120, 120] | 1.2 * working capital/assets |
Retained earnings componentretained_earnings_componentratio · [-140, 140] | ratio | [-140, 140] | 1.4 * retained earnings/assets |
EBIT componentebit_componentratio · [-330, 330] | ratio | [-330, 330] | 3.3 * EBIT/assets |
Equity componentequity_componentratio · [0, 60] | ratio | [0, 60] | 0.6 * market equity/book liabilities |
Sales componentsales_componentratio · [0, 100] | ratio | [0, 100] | 0.999 * sales/assets |
Eight-variable M-score (beneish_m): 10 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Eight-variable M-score | |
M scorem_scoreratio · [-1000, 1000] | ratio | [-1000, 1000] | -4.84 plus the eight weighted components; no probability or classification implied |
DSRI componentdsri_componentratio · [0, 100] | ratio | [0, 100] | 0.920 * DSRI |
GMI componentgmi_componentratio · [0, 100] | ratio | [0, 100] | 0.528 * GMI |
AQI componentaqi_componentratio · [0, 100] | ratio | [0, 100] | 0.404 * AQI |
SGI componentsgi_componentratio · [0, 100] | ratio | [0, 100] | 0.892 * SGI |
DEPI componentdepi_componentratio · [0, 100] | ratio | [0, 100] | 0.115 * DEPI |
SGAI componentsgai_componentratio · [-100, 0] | ratio | [-100, 0] | -0.172 * SGAI |
TATA componenttata_componentratio · [-500, 500] | ratio | [-500, 500] | 4.679 * TATA |
LVGI componentlvgi_componentratio · [-100, 0] | ratio | [-100, 0] | -0.327 * LVGI |
Nine original binary signals (piotroski_f): 11 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Nine original binary signals | |
F scoref_scorecount · [0, 9] | count | [0, 9] | Sum of the nine binary signals |
Positive ROApositive_roacount · [0, 1] | count | [0, 1] | Positive ROA signal |
Positive CFOpositive_cfocount · [0, 1] | count | [0, 1] | Positive CFO signal |
Improving ROAimproving_roacount · [0, 1] | count | [0, 1] | Increasing ROA signal |
Cash exceeds incomecash_exceeds_incomecount · [0, 1] | count | [0, 1] | CFO greater than ROA signal |
Decreasing leveragedecreasing_leveragecount · [0, 1] | count | [0, 1] | Decreasing leverage signal |
Improving liquidityimproving_liquiditycount · [0, 1] | count | [0, 1] | Increasing current ratio signal |
No equity issuanceno_equity_issuancecount · [0, 1] | count | [0, 1] | No common equity issuance signal |
Improving marginimproving_margincount · [0, 1] | count | [0, 1] | Increasing gross margin signal |
Improving turnoverimproving_turnovercount · [0, 1] | count | [0, 1] | Increasing asset turnover signal |
Calculator
Run the model on your own inputs, starting from its example. Rates are decimals: 0.05 is five percent. The run goes to the pyeconomics API on this site: your values travel only in the request, and nothing is stored.
Loading the calculator…
Worked example
Example formula_altman_z. Inputs:
{
"calculation": "altman_z",
"ebit_to_assets": 0,
"market_equity_to_liabilities": 0,
"retained_earnings_to_assets": 0,
"sales_to_assets": 0,
"working_capital_to_assets": 0
}Outputs:
{
"calculation": "altman_z",
"ebit_component": 0,
"equity_component": 0,
"retained_earnings_component": 0,
"sales_component": 0,
"working_capital_component": 0,
"z_score": 0,
"zone": "distress"
}Assumptions
- Altman ratios are decimals: the original .012/.014/.033/.006 coefficients on percentage inputs become 1.2/1.4/3.3/.6; sales turnover retains .999.
- Beneish inputs are the eight precomputed variables defined in the schema, with original Table 3 coefficients. TATA uses the original balance-sheet accrual definition.
- Piotroski accepts nine precomputed binary signals; each strict comparison and denominator convention is stated in its input description.
Limitations
- Altman was estimated on 66 US manufacturing firms, 33 bankrupt in 1946-1965 with matched nonbankrupt firms; it is not the private/nonmanufacturing variant. Bands are historical labels, not credit recommendations.
- Beneish's estimation sample covers identified US earnings manipulators in 1982-1992, excluding financial firms; coefficients are not a calibrated probability. Negative or undefined input indices must be resolved upstream.
- Piotroski studied high book-to-market US firms in 1976-1996; supplied binary signals must use comparable financial statements. None of the scores or bands is a buy, sell or credit recommendation.
Evidence
Status: practitioner. A widely used rule of thumb or convention.
Every model declares one status: standard (textbook consensus), practitioner (a widely used convention), contested (under active debate), rejected (failed out of sample) or historical (a superseded methodology).
Syllabus
The 2027 CFA® Program's topic areas this model relates to, as factual tags. Each links to CFA Institute's page for its level; pyeconomics holds none of the curriculum's text.
Citations
- Altman, E. I. (1968). Financial Ratios, Discriminant Analysis and the Prediction of Corporate Bankruptcy. Journal of Finance 23, 589-609. doi:10.1111/j.1540-6261.1968.tb00843.x (Equation (1), p. 594; zones, p. 606)
- Beneish, M. D. (1999). The Detection of Earnings Manipulation. Financial Analysts Journal 55(5), 24-36. doi:10.2469/faj.v55.n5.2296 (Variable definitions and Table 3)
- Piotroski, J. D. (2000). Value Investing: The Use of Historical Financial Statement Information to Separate Winners from Losers. Journal of Accounting Research 38, 1-41. doi:10.2307/2672906 (Sections 2.3.1-2.3.3; equation (1))
Changelog
- Version 1: First version.
Use it elsewhere
- Documentation
- The model's reference page
- REST API
GET or POST /v1/models/accounting.scoring_models/run- MCP tool
run_modelwith the model's id,accounting.scoring_models. Connect an assistant- Command line
pyeconomics models run accounting.scoring_models --help
The worked example, from Python and from the command line:
import pyeconomics
inputs = {
"calculation": "altman_z",
"ebit_to_assets": 0,
"market_equity_to_liabilities": 0,
"retained_earnings_to_assets": 0,
"sales_to_assets": 0,
"working_capital_to_assets": 0,
}
result = pyeconomics.run("accounting.scoring_models", inputs)
print(result.to_json())
pyeconomics models run accounting.scoring_models --inputs - <<'JSON'
{
"calculation": "altman_z",
"ebit_to_assets": 0,
"market_equity_to_liabilities": 0,
"retained_earnings_to_assets": 0,
"sales_to_assets": 0,
"working_capital_to_assets": 0
}
JSON