DPredict · Guide test 175
Ramsey RESET
Tests whether added functions of fitted values or predictors reveal omitted nonlinear structure.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Linear regression (OLS) — How does a numeric outcome depend on one or more predictors?
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
Adds curve × (x − 5)².
Error SD grows like exp(h · (x − 5)/5).
Errors in collection order carry φ × the previous error.
Your data
Simulated with a known ρIf H₀ were true
- The reference: how F varies across samples when H₀ is true.
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .002).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- powers of the fitted values
- 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 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
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.
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>
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
- lmtest — lmtest · resettestAuthor documentation/source reviewed: lmtest 0.9-40.search.r-project.org
- resettestsearch.r-project.org
- 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.