statsmodels / statsmodels/statsmodels

fvalue and mse_model are -inf if only 1 regressor

Open
#60 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

comp-regression corner-case
Dominant language
Python
Stars
11.6k
Forks
3.6k
Avg merge
7h 37m
Merged PRs (30d)
96

Description

Original Launchpad bug 440151: https://bugs.launchpad.net/statsmodels/+bug/440151
Reported by: josef-pktd (joep).

the tests for dimension of exog, endog for model fail because -if is not equal -inf.
The source I think is if exog is only 1d or one column, then the df_model = 0, which, I think, causes a zero division for fvalue and mse_model

It is necessary to fix test and to check whether the -inf result is actually correct.
I did the initial correction in the test for fvalue, but commented it out again, because we need to check first if -inf is correct.

In the example, the df_model should be 1 instead of 0.
I think we need a hasconstant indicator so we can use
the correct df if there is only 1 (non-constant) regressor.

If we correct df_model by not subtracting 1, then we won't get -inf in the
case of this ticket, and we can ignore that -inf != -inf with numpy <= 1.3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the dimension tests for exog and endog and trace how df_model is computed for a single-regressor model. Check the resulting fvalue and mse_model calculations, including the proposed hasconstant distinction, and determine whether the expected result should be finite or -inf before updating the tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.