Ramsey RESET Test
Calculate Ramsey’s RESET test for functional form misspecification of a regression of dependent_ticker on independent_tickers.
If the true relationship is non-linear, or a relevant transformation or variable is missing, the fitted values of a linear regression still carry information about that missing piece. RESET tests for this by adding powers of the fitted values (fitted^2, …, fitted^power) to the regression and checking whether they are jointly significant with an F-test that compares the original (restricted) and augmented (unrestricted) model.
The formula is as follows:
\[\text{Augmented model:}\;\; y_{t} = \text{x\_t'} \cdot \beta + \text{SUM\_\{j} = \text{2\}} ^{\text{\{power\}}} (\gamma_{j} \cdot \text{yhat}_{t} ^{j}) + u_{t},\;\; \text{with}\; \text{yhat}_{t} \;\text{the fitted values of the original OLS regression and}\; \text{power} = 3 \;\text{by default}\] \[F = ((\text{RSS}_{r} - \text{RSS}_{u}) / q) / (\text{RSS}_{u} / (n - k_{u}))\]Where RSS_r and RSS_u are the residual sums of squares of both models, q is the number of added terms (power - 1), n the number of observations and k_u the number of parameters of the augmented model. Under the null hypothesis that the linear form is correct, F follows an F(q, n - k_u) distribution. A low p-value suggests the model is missing something, for example a squared or interaction term or a log transformation, without saying what; it is a signal to reconsider the specification, not a prescription.
For more information about the method, see the following paper:
- Ramsey, J.B. (1969). “Tests for Specification Errors in Classical Linear Least-Squares Regression Analysis.” Journal of the Royal Statistical Society, Series B, 31(2), 350-371.
Also known as: RESET test, Ramsey RESET.
Ramsey RESET Test in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_ramsey_reset_test as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["NKE", "ADS.DE"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2025-01-01",
end_date="2025-12-31",
)
# NKE (the first ticker) is dependent; ADS.DE is independent
toolkit.econometrics.get_ramsey_reset_test()
Or, after setting up the Finance Toolkit MCP, ask:
Was a regression of Nike's daily returns on Adidas' well specified in 2025, according to the Ramsey RESET test?
Which returns:
| Value | |
|---|---|
| RESET F-Statistic | 1.4847 |
| P-Value | 0.2285 |
| Reject Correct Specification (5%) | 0 |
Using Your Own Data
get_ramsey_reset_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_ramsey_reset_test()
Parameters
get_ramsey_reset_test accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
dependent_ticker | str | None | The dependent (predicted) asset. Defaults to None, meaning the Toolkit instance’s first ticker. | "AAPL" |
independent_tickers | str | list[str] | None | The independent (predictor) asset(s). Defaults to None, meaning every other ticker in the Toolkit instance besides dependent_ticker. | ["MSFT", "Benchmark"] |
include_benchmark | bool | Whether to include “Benchmark” in the default independent ticker(s) (has no effect when independent_tickers is given explicitly). Defaults to False. | True |
period | str | The data frequency (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”. | "weekly" |
column | str | The historical data column to regress on. Defaults to “Return”. | "Return" |
add_constant | bool | Whether to include an intercept in the underlying regression. Defaults to True. | False |
power | int | The highest power of the fitted values to add. Defaults to 3. | 2 |
rounding | int | None | The number of decimals to round the results to. Defaults to None. | 2 |