Harvey-Collier Test

The Harvey-Collier Test of Harvey and Collier (1977) uses the recursive residuals, the one-step-ahead forecast errors of the regression fitted on everything before each date. When the linear form is right these are independent with mean zero; a missing non-linear term makes them drift to one side, so their mean moves away from zero.

The formula for the Harvey-Collier Test computes the recursive residual \(w_{t}\) of every date from the regression fitted on the observations before it, scaled to the same variance:

\[w_{t} = \frac{y_{t} - x'_{t} \cdot \hat{b}_{t-1}}{\sqrt{1 + x'_{t} \cdot (X'_{t-1} \cdot X_{t-1})^{-1} \cdot x_{t}}}\]

The statistic is the t-statistic of the mean of these residuals:

\[m = n - k\] \[t = \frac{\sqrt{m} \cdot \bar{w}}{s_{w}}\]

Where \(y_{t}\) is the dependent series, \(x_{t}\) the regressors on date t, hat(b(t-1)) the OLS fit on the first t - 1 observations X(t-1), n the number of observations, k the number of parameters, m the number of recursive residuals (for \(t = k + 1\), …, n), bar(w) their mean and \(s_{w}\) their standard deviation. t is Student-t with m - 1 degrees of freedom under the null: the linear form is rejected when the two-sided p-value is below the significance level (0.05 for the 5% level). The order of the observations matters: it detects a misspecification that shows up along the time order of the sample, such as a curve in a trending regressor or a drifting relation.

A test of the functional form asks whether a linear regression describes the relation correctly, the null hypothesis, or misses a non-linear term, a transformation or a relevant variable, the alternative. A misspecified form biases the coefficients and leaves structure in the residuals. The tests say that something is missing, not what: a rejection is a signal to reconsider the specification, for example with a squared or interaction term or a log transformation, not a prescription.

Also known as: recursive residuals test, Harvey-Collier t-test.

In the Finance Toolkit this is get_ramsey_reset_test with method="harvey_collier", the same function as Ramsey RESET Test.

Example · NKE, ADS.DE · 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_ramsey_reset_test:

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(method="harvey_collier")

Which returns:

Item 0
Harvey-Collier t-Statistic 0.0165
P-Value 0.9868
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()

References

  • Paper Harvey, A.C. and Collier, P. (1977). “Testing for Functional Misspecification in Regression Analysis.” Journal of Econometrics, 6(1), 103-119.
  • Library Referenced against statsmodels’ linear_harvey_collier (Harvey-Collier Test)
Share