Skip to content

DPredict · Guide test 175

Ramsey RESET

Tests whether added functions of fitted values or predictors reveal omitted nonlinear structure.

Runs in CodeSplashPython example validatedR example validated

Do it in CodeSplash

In the app, set it up in Analyze with this method:

Do it in CodeSplash Run this test on your own data, in Python or R.

Bench

Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.

Bench · Ramsey RESET

40
0.30
0.060

Adds curve × (x − 5)².

0.00

Error SD grows like exp(h · (x − 5)/5).

0.00

Errors in collection order carry φ × the previous error.

0.00
0.050

Your data

Simulated with a known ρ

If H₀ were true

F = 7.14
  1. The reference: how F varies across samples when H₀ is true.
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .002).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

F=(RSS0−RSS1)/2RSS1/(n−4) adding y^2, y^3F = \dfrac{(\mathrm{RSS}_0-\mathrm{RSS}_1)/2}{\mathrm{RSS}_1/(n-4)}\ \text{adding }\hat y^2,\ \hat y^3

With your numbers

F=7.14,ν1=2, ν2=36F = 7.14,\quad \nu_1 = 2,\ \nu_2 = 36
y^2, y^3\hat y^2,\ \hat y^3
powers of the fitted values
RSS0, RSS1\mathrm{RSS}_0,\ \mathrm{RSS}_1
residual sums of squares without and with them

The verdict

F(2, 36) = 7.14, p = .002

p ≤ α = .050: reject H₀

A general misspecification alarm: it says the form is wrong, not how. Look at residual plots next.

Statistic
7.137
p-value
0.0025
Ramsey RESET on 40 (x, y) pairs: F(2, 36) = 7.14, p = .002. The p-value is below α = .050, so the data are hard to reconcile with H0.

Ramsey RESET on 40 (x, y) pairs: F(2, 36) = 7.14, p = .002. The p-value is below α = .050, so the data are hard to reconcile with H₀.

Question and hypotheses

H0: the added nonlinear specification terms have zero coefficients.

Assumptions

A correctly specified regression error structure under H0; ordinary F inference assumes independent normal homoskedastic errors; robust Wald versions relax some conditions.

Formula

y=Xβ+∑j=2Jγjy^ j+uH0:γ2=⋯=γJ=0\begin{gathered}y=X\beta+\sum_{j=2}^{J}\gamma_j\widehat y^{\,j}+u\\[5pt] H_0:\gamma_2=\cdots=\gamma_J=0\end{gathered}

Parameters and notation

ŷ are original fitted values; J is selected power order. Other RESET variants use powers of regressors or principal components.

Structure of the method

Fit the original linear mean model, construct selected powers of fitted values or regressors, and refit an augmented regression. A joint coefficient restriction on the added columns produces an F or Wald statistic. The generated regressors are diagnostic probes of functional form, not a uniquely identified replacement model.

Estimated and nuisance parameters

Original regression coefficients, augmented-model coefficients, residual variance, and the coefficient covariance matrix are estimated. The added coefficients are tested jointly; their count is the independent column rank after removing redundancy, not simply the number of requested powers.

Settings and design choices

Prespecify powers, fitted-value versus regressor/principal-component construction, covariance estimator, and handling of categorical columns. High powers may need numerical scaling. Searching many augmentations and reporting one favorable p-value turns a single diagnostic into a selection problem.

Fitting and adaptation

Fit both models on identical complete observations. If heteroskedasticity or clustering is expected, use an appropriate supported robust covariance rather than interpreting the ordinary F reference as universally valid. Refit an improved scientific model after diagnosis and validate it on independent data; this is statistical model revision, not neural fine-tuning.

Sensitivity and robustness

Power depends on whether the omitted structure aligns with the chosen generated columns. Collinearity, leverage, small residual degrees of freedom, and mean/variance misspecification complicate interpretation. A nonsignificant RESET result does not validate exogeneity, independence, causality, or all nonlinear alternatives. Report the augmentation and robust-covariance choice explicitly.

How to use and calibrate

Fit the augmented model and use a joint partial F/Wald test on added terms; state powers and covariance estimator.

Example application

Detect omitted nonlinear structure in a linear mean model.

Interpretation and pitfalls

Watch out

Rejection does not tell which variable or functional form is missing. Generated terms and model selection require the stated approximation.

What changed in edition 2

  • New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.

Python and R

Read the directional model comparison carefully: nonnested procedures can reject neither, one, or both models. A specification rejection does not identify the correct replacement model.

Python · native

Validated — Executed successfully in the validation environment · needs numpy, scipy, statsmodels

import numpy as np
from scipy import stats
rng = np.random.default_rng(2026)
import statsmodels.api as sm
n=100
x=rng.normal(size=n); z=rng.normal(size=n); y=1+.5*x+.3*z+rng.normal(size=n)
X=sm.add_constant(np.column_stack([x,z])); fit=sm.OLS(y,X).fit(); reduced=sm.OLS(y,X[:,:2]).fit()
from statsmodels.stats.diagnostic import linear_reset
print(linear_reset(fit,power=3,use_f=True))
Output
<F test: F=0.10981793508959255, p=0.8961108265868163, df_denom=95, df_num=2>
R

Validated — Executed successfully in the validation environment · needs lmtest

set.seed(2026)
n <- 100; x <- rnorm(n); z <- rnorm(n); y <- 1+.5*x+.3*z+rnorm(n)
d <- data.frame(y,x,z); fit <- lm(y~x+z,data=d); reduced <- lm(y~x,data=d)
print(lmtest::resettest(fit,power=2:3,type="fitted"))
Output
	RESET test

data:  fit
RESET = 0.92755, df1 = 2, df2 = 95, p-value = 0.3991

Sources

Statistics guide v4 (historical):
Python: Executed successfully in the validation environment · R: Executed successfully in the validation environment
Reference's record:
Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Unavailable local dependencies: statsmodels. Python: Not run in the reference's review: Unavailable local dependencies: statsmodels. No installation attempted. R: Reviewed but not run: R wasn't available to the reference's authors.

From the CodeSplash statistics guide (v4), entry 175, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT175.