Mincer-Zarnowitz Test
Calculate the Mincer-Zarnowitz test per asset: whether a volatility forecast is unbiased and efficient, judged by regressing the realized variance on the forecast.
A good forecast has an intercept of 0 and a slope of 1: the realized variance is on average what was forecast. A slope below 1 means the forecast moves more than the variance that follows (it overreacts), above 1 that it moves too little. The R-squared shows how much of the variation in the realized variance the forecast explains, the usual way to rank volatility forecasts of the same asset (Andersen and Bollerslev, 1998). The squared return is a noisy measure of the variance, so the R-squared stays low even for a good forecast.
The formula is as follows:
\[\text{Realized Variance}_{t} = r_{t}^{2}\] \[\sigma_{t}^{2} = \lambda \cdot \sigma_{t-1}^{2} + (1 - \lambda) \cdot r_{t-1}^{2}\] \[r_{t}^{2} = a + b \cdot \hat{\sigma}_{t}^{2} + e_{t}\] \[W = D' \cdot \operatorname{cov}\left(\hat{\beta}\right)^{-1} \cdot D\] \[\text{where}\;\; D = \hat{\beta} - \beta_{0}\] \[F = \frac{W}{2}\]with \(\sigma_{t}^{2}\) the EWMA forecast, lambda = lambda_ (0.94 by default), so the forecast for t uses returns up to t - 1. The rolling forecast is the sample variance (ddof=1) of the window (22 by default) returns up to t - 1. The regression is fitted by least squares with hat(beta) = (a, b)’ and \(\beta_{0}\) = (0, 1)’, so W is the Wald statistic of \(a = 0\) and \(b = 1\), and F is F-distributed with 2 and n - 2 degrees of freedom. cov(hat(beta)) is the ordinary least squares covariance, or the Newey-West covariance with lags lags (0 by default).
Also known as: MZ regression, forecast efficiency test, forecast unbiasedness test.
Example · XOM, CVX, SHEL, BP · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_mincer_zarnowitz_test:
from financetoolkit import Toolkit
toolkit = Toolkit(
["XOM", "CVX", "SHEL", "BP"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.econometrics.get_mincer_zarnowitz_test(lags=5)
Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:
Were the forecasts of an autoregressive model with five lags unbiased for the daily returns of ExxonMobil, Chevron, Shell and BP from 2021 to 2025, by the Mincer-Zarnowitz test?
Which returns:
| Item | XOM | CVX | SHEL | BP |
|---|---|---|---|---|
| Intercept | 0.0001 | 0.0001 | 0.0002 | 0.0002 |
| Slope | 0.4378 | 0.6155 | 0.1938 | 0.2136 |
| R Squared | 0.0447 | 0.0331 | 0.0218 | 0.0204 |
| F-Statistic | 18.1866 | 4.1724 | 73.5504 | 75.3465 |
| P-Value | 0.0000 | 0.0156 | 0.0000 | 0.0000 |
| Observations | 1,253.0000 | 1,253.0000 | 1,253.0000 | 1,253.0000 |
6 rows
Using Your Own Data
get_mincer_zarnowitz_test runs on any data, not only prices: ratios, economic indicators, yield curves or your own dataset. Pass a DataFrame, a Series or a dictionary of them to Econometrics as data, with the dates in the rows or the columns, and set changes to how its changes are calculated: "percentage", "log", "difference" for rates and ratios, or None when the data are changes already. For example, for the monthly unemployment rates of the United States and Germany:
from financetoolkit import Economics, Econometrics
economics = Economics(start_date="2000-01-01")
unemployment = economics.get_unemployment_rate(
countries=["United States", "Germany"], period="monthly"
)
econometrics = Econometrics(data=unemployment, changes="difference")
econometrics.get_mincer_zarnowitz_test()
Parameters
get_mincer_zarnowitz_test accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The data frequency for returns (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”, since window is expressed in return observations of this frequency. | "weekly" |
method | str | The volatility forecasting method. Options are: “ewma” (RiskMetrics EWMA), “rolling” (rolling sample variance). Defaults to “ewma”. | "ewma" |
window | int | The rolling window size used by the rolling method, at least 2. Defaults to 22 (approximately one trading month). | 20 |
lambda_ | float | The decay factor used by the EWMA method. Defaults to 0.94. | 0.97 |
lags | int | The Newey-West lags of the covariance of the coefficients, 0 for the ordinary least squares covariance. Defaults to 0. | 2 |
include_benchmark | bool | Whether to include “Benchmark” among the assets tested. Defaults to False. | True |
rounding | int | None | The number of decimals to round the results to. Defaults to None. | 2 |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
References
- Paper Mincer, J.A. and Zarnowitz, V. (1969). “The Evaluation of Economic Forecasts.” In Economic Forecasts and Expectations: Analysis of Forecasting Behavior and Performance, NBER, 3-46.
- Paper Andersen, T.G. and Bollerslev, T. (1998). “Answering the Skeptics: Yes, Standard Volatility Models do Provide Accurate Forecasts.” International Economic Review, 39(4), 885-905.
- Library Referenced against statsmodels’ RegressionResults.wald_test