Okun's law
Okun's law estimated in its gap form (the output gap on the unemployment gap) and its first-difference form (the change in unemployment on output growth, with the growth that holds unemployment constant).
- Model id
macro.okun_law, version 1- Domain
- Macroeconomics
- Evidence
- practitioner
- Cost class
- instant: A closed-form calculation; a hosted run may take up to 2 seconds.
Formula
Where
- The output gap in period t
output_gap - The intercept
intercept - The slope
slope - The unemployment rate in period t
unemployment - The natural rate of unemployment in period t
natural_unemployment - The residual in period t
- Output growth over the last k periods, for a year
- Output in period t
output - Periods the change is taken over
span - Periods in a year
periods_per_year
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
The output gap on the unemployment gap (gap): 6 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Covariancecovariancetext | text | Standard errors: 'newey_west' (heteroskedasticity and autocorrelation consistent), 'hc1' (heteroskedasticity consistent) or 'classical' | |
Lagslagscount · [0, 100] | count | [0, 100] | Newey-West lags; left out, Newey and West's rule floor(4 (n/100)^(2/9)) |
Calculationcalculationtext | text | The output gap on the unemployment gap | |
Output gapoutput_gaprate (array) · length min 3, max 1000; each [-0.3, 0.3] | rate (array) | length min 3, max 1000; each [-0.3, 0.3] | The output gap each period (real GDP over potential, less one) |
Unemploymentunemploymentrate (array) · length min 3, max 1000; each [0, 0.3] | rate (array) | length min 3, max 1000; each [0, 0.3] | The unemployment rate each period |
Natural unemploymentnatural_unemploymentrate (array) · length min 3, max 1000; each [0, 0.3] | rate (array) | length min 3, max 1000; each [0, 0.3] | The natural rate of unemployment each period |
The change in unemployment on output growth (difference): 7 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Covariancecovariancetext | text | Standard errors: 'newey_west' (heteroskedasticity and autocorrelation consistent), 'hc1' (heteroskedasticity consistent) or 'classical' | |
Lagslagscount · [0, 100] | count | [0, 100] | Newey-West lags; left out, Newey and West's rule floor(4 (n/100)^(2/9)) |
Calculationcalculationtext | text | The change in unemployment on output growth | |
Outputoutputmoney (array) · length min 4, max 1000; each (0, 1e+15] | money (array) | length min 4, max 1000; each (0, 1e+15] | Real output each period, positive |
Unemploymentunemploymentrate (array) · length min 4, max 1000; each [0, 0.3] | rate (array) | length min 4, max 1000; each [0, 0.3] | The unemployment rate each period |
Spanspancount · [1, 12] | count | [1, 12] | Periods each growth rate and change spans (4 for over a year) |
Periods per yearperiods_per_yearcount · [1, 12] | count | [1, 12] | Periods in a year, to annualize growth by compounding (4 for quarterly data); left out, growth is over the span |
Outputs
The output gap on the unemployment gap (gap): 9 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Slopesloperatio · [-1e+09, 1e+09] | ratio | [-1e+09, 1e+09] | The coefficient on the gap |
Interceptinterceptratio · [-1e+09, 1e+09] | ratio | [-1e+09, 1e+09] | The constant |
Slope standard errorslope_standard_errorratio · [0, 1e+09] | ratio | [0, 1e+09] | The slope's standard error |
Intercept standard errorintercept_standard_errorratio · [0, 1e+09] | ratio | [0, 1e+09] | The intercept's standard error |
Slope t statisticslope_t_statisticratio · [-1e+09, 1e+09] | ratio | [-1e+09, 1e+09] | The slope over its standard error; None for a fit exact to rounding |
R squaredr_squaredratio · [0, 1] | ratio | [0, 1] | R-squared; None when the dependent variable does not vary |
Observationsobservationscount · [3, 1000] | count | [3, 1000] | Observations in the regression |
HAC lagshac_lagscount · [0, 100] | count | [0, 100] | Newey-West lags used; 0 for the others |
Calculationcalculationtext | text | The output gap on the unemployment gap |
The change in unemployment on output growth (difference): 10 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Slopesloperatio · [-1e+09, 1e+09] | ratio | [-1e+09, 1e+09] | The coefficient on the gap |
Interceptinterceptratio · [-1e+09, 1e+09] | ratio | [-1e+09, 1e+09] | The constant |
Slope standard errorslope_standard_errorratio · [0, 1e+09] | ratio | [0, 1e+09] | The slope's standard error |
Intercept standard errorintercept_standard_errorratio · [0, 1e+09] | ratio | [0, 1e+09] | The intercept's standard error |
Slope t statisticslope_t_statisticratio · [-1e+09, 1e+09] | ratio | [-1e+09, 1e+09] | The slope over its standard error; None for a fit exact to rounding |
R squaredr_squaredratio · [0, 1] | ratio | [0, 1] | R-squared; None when the dependent variable does not vary |
Observationsobservationscount · [3, 1000] | count | [3, 1000] | Observations in the regression |
HAC lagshac_lagscount · [0, 100] | count | [0, 100] | Newey-West lags used; 0 for the others |
Calculationcalculationtext | text | The change in unemployment on output growth | |
Constant unemployment growthconstant_unemployment_growthratio · [-1e+09, 1e+09] | ratio | [-1e+09, 1e+09] | The growth that holds unemployment constant, -intercept / slope, annualized as growth is; None when the slope is zero |
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 gap_form. Inputs:
{
"calculation": "gap",
"covariance": "newey_west",
"lags": null,
"natural_unemployment": [0.044, 0.044, 0.044, 0.044, 0.044, 0.044, 0.044, 0.044],
"output_gap": [
0.004, 0.009, 0.012, 0.01,
0.002, -0.006, -0.008, -0.005
],
"unemployment": [0.042, 0.04, 0.038, 0.039, 0.043, 0.047, 0.048, 0.046]
}Outputs:
{
"calculation": "gap",
"hac_lags": 2,
"intercept": -0.00006691449814125894,
"intercept_standard_error": 0.00012161628841038876,
"observations": 8,
"r_squared": 0.9961743360265892,
"slope": -2.0594795539033455,
"slope_standard_error": 0.031010083144833767,
"slope_t_statistic": -66.41322257294404
}Assumptions
- Least squares on the given series; Newey-West errors by default, with Bartlett weights, no small-sample correction and Newey and West's lag rule when no lag is given.
- The output gap is a ratio (real GDP over potential, less one); growth is a rate over the span, annualized by compounding when periods_per_year is given; unemployment rates are decimals.
- Profile: default binds 120 quarters of real GDP over CBO's potential, the unemployment rate (the quarter's last month) and CBO's noncyclical rate for the gap form, and real GDP with the unemployment rate for the difference form.
Limitations
- Okun's law is an empirical regularity, not a structural relation: the coefficient varies over time and across countries and shifts in recessions.
- The difference form's constant-unemployment growth is undefined when the slope is zero: None, with a warning.
- A gap or a change that barely varies leaves the slope unidentified, and output that changes by a factor beyond representation has no growth rate: both raise DomainError.
- Monthly unemployment is read at each quarter's last month: a quarter's average is missing when the source left a month out (BLS published no October 2025 household survey), and a window never takes a gap.
- In hosted mode, where FRED is refused, the originators serve too short a history for the default windows (BLS about three years, CBO's potential and natural rate from 2021), so the bind raises: supply the series instead.
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.
Data
This model can read its data for you: each bound field names a data series, and the sources listed can fill it, in the order they are tried. This website reads only the sources whose terms let it serve their data (marked "hosted"); every source is available when you run pyeconomics on your own computer.
| Field | Concept | Read as | Sources (licence class; hosted) |
|---|---|---|---|
output_gap | Output gap, real GDP over potentialus.output_gap.real_potential | the last 120 observations on or before the date; real time: as published by the date |
|
unemployment | Unemployment rateus.unemployment.rate | the last 120 observations on or before the date; real time: as published by the datetransform convert(to=quarterly,method=last) |
|
natural_unemployment | Noncyclical rate of unemploymentus.unemployment.noncyclical_rate | the last 120 observations on or before the date; real time: as published by the date |
|
output | Real GDPus.output.real_gdp | the last 120 observations on or before the date; real time: as published by the date |
|
Citations
- Okun, A. M. (1962). Potential GNP: Its Measurement and Significance. Proceedings of the Business and Economic Statistics Section of the American Statistical Association, 98-104. https://milescorak.com/wp-content/uploads/2016/01/okun-potential-gnp-its-measurement-and-significance-p0190.pdf (The first-differences and gap relations between output and unemployment)
- Knotek, E. S. II (2007). How Useful Is Okun's Law? Federal Reserve Bank of Kansas City Economic Review, 92(4), 73-103. https://www.kansascityfed.org/Economic%20Review/documents/955/2007-How%20Useful%20is%20Okun%27s%20Law%3F.pdf (The difference and gap versions estimated on US data)
- Ball, L., Leigh, D. and Loungani, P. (2017). Okun's Law: Fit at 50? Journal of Money, Credit and Banking, 49(7), 1413-1441. doi:10.1111/jmcb.12420 (The gap version across countries and its stability)
Changelog
- Version 1: First version.
Use it elsewhere
- Documentation
- The model's reference page
- REST API
GET or POST /v1/models/macro.okun_law/run- MCP tool
run_modelwith the model's id,macro.okun_law. Connect an assistant- Command line
pyeconomics models run macro.okun_law --help
The worked example, from Python and from the command line:
import pyeconomics
inputs = {
"calculation": "gap",
"covariance": "newey_west",
"lags": None,
"natural_unemployment": [0.044, 0.044, 0.044, 0.044, 0.044, 0.044, 0.044, 0.044],
"output_gap": [
0.004, 0.009, 0.012, 0.01,
0.002, -0.006, -0.008,
-0.005,
],
"unemployment": [0.042, 0.04, 0.038, 0.039, 0.043, 0.047, 0.048, 0.046],
}
result = pyeconomics.run("macro.okun_law", inputs)
print(result.to_json())
pyeconomics models run macro.okun_law --inputs - <<'JSON'
{
"calculation": "gap",
"covariance": "newey_west",
"lags": null,
"natural_unemployment": [0.044, 0.044, 0.044, 0.044, 0.044, 0.044, 0.044, 0.044],
"output_gap": [
0.004, 0.009, 0.012, 0.01,
0.002, -0.006, -0.008, -0.005
],
"unemployment": [0.042, 0.04, 0.038, 0.039, 0.043, 0.047, 0.048, 0.046]
}
JSON