Skip to content

BUG/ENH: wald test, wald_test_terms, degrees of freedom for rank-deficient cases #9686

Description

@josef-pkt

related to #1717
update directly related general issue #8512

I'm using an over-parameterized model (columns of zeros) estimated with fit_zeros.
I get a rank warning when I use wald_test_terms

example

res3z.wald_test_terms(scalar=True)
...\statsmodels\base\model.py:1902: ValueWarning: covariance of constraints does not have full rank. 
The number of constraints is 24, but rank is 8
  warnings.warn('covariance of constraints does not have full '
<class 'statsmodels.stats.contrast.WaldTestResults'>
                                 F           P>F  df constraint  df denom
Intercept               232.071429  8.844181e-15              1      27.0
C(fertilizer)            32.595238  6.311739e-08              2      27.0
C(fertilizer):C(tech0)   14.446429  6.061365e-08             24      27.0

It looks like it is using the wrong df_constraint.
When I parameterize the model in a different way so that it is not rank-deficient, then the df are the reduced ones, e.g. 8 instead of 24.

I have not verified yet, what the result is supposed to be.

I guess the same will be the case with just wald_test for a joint hypothesis.

Aside:
F-statistic, AIC and BIC in the summary table seems to be correct, they are the same between over-parameterized and not over-parameterized models. It looks like they use rank of exog and not the number of columns.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions