Skip to content

Model F statistic tests the wrong hypothesis when the constant is implied by dummies #780

Open

Description

@bashtage

When the constant is implied by regressors rather than included as a column of ones (for example, two dummies that sum to one), the model F statistic does not test "all coefficients except the intercept are zero".

import numpy as np
import pandas as pd
from linearmodels.iv import IV2SLS

rng = np.random.default_rng(0)
n = 200
g = np.arange(n) % 2
x = pd.DataFrame(
    {"d0": (g == 0).astype(float), "d1": (g == 1).astype(float), "x": rng.standard_normal(n)}
)
y = 1.0 + 0.3 * x.d1 + 0.2 * x.x + rng.standard_normal(n)
res = IV2SLS(y, x, None, None).fit(cov_type="unadjusted")
res.f_statistic  # 227.68 on 3 df: tests d0 = d1 = x = 0, which includes the intercept

The test of no explanatory power beyond the intercept is d0 = d1 and x = 0. Its Wald statistic is 10.77 on 2 df.

The system models detect the constant in this case, but drop an arbitrary dummy, so the F statistic tests "the other dummy and the slopes are zero" (25.76 against 33.44 for the correct test in one example). The panel results use the same logic.

Deferred from 7.1. The fix should either find the implied intercept and test the right restrictions, or document that the model F statistic needs an explicit constant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions