Skip to content

RegressionResultsWrapper.fvalue, typically scalar, becomes 2D array with robust standard errors #6778

Closed

Description

@toobaz

Describe the bug

In [1]: from statsmodels.datasets import grunfeld                                                                                                                                                

In [2]: from statsmodels.api import OLS                                                                                                                                                          

In [3]: data = grunfeld.load_pandas().data.set_index(['firm','year'])                                                                                                                            

In [4]: mod = OLS(data.invest, data[['value','capital']])                                                                                                                                        

In [5]: mod.fit().fvalue                                                                                                                                                                         
Out[5]: 656.9203978616093

In [6]: mod.fit(cov_type='HC1').fvalue                                                                                                                                                           
Out[6]: array([[194.95274665]])

Notice that Out[5] is a scalar but Out[6] is a 2D (1x1) numpy array.

This popped out in StatsReporting/stargazer#33 .

Expected Output

Same format (scalar, I guess).

Output of import statsmodels.api as sm; sm.show_versions()

Details

INSTALLED VERSIONS

Python: 3.7.3.final.0
OS: Linux 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64
byteorder: little
LC_ALL: None
LANG: it_IT.UTF-8

statsmodels

Installed: 0.11.1 (/home/pietro/.local/lib/python3.7/site-packages/statsmodels)

Required Dependencies

cython: 0.29.17 (/home/pietro/.local/lib/python3.7/site-packages/Cython)
numpy: 1.16.4 (/home/pietro/.local/lib/python3.7/site-packages/numpy)
scipy: 1.1.0 (/usr/lib/python3/dist-packages/scipy)
pandas: 1.1.0.dev0+276.g2495068ad (/home/pietro/nobackup/repo/pandas/pandas)
dateutil: 2.8.0 (/home/pietro/.local/lib/python3.7/site-packages/dateutil)
patsy: 0.5.1+dev (/home/pietro/nobackup/repo/patsy/patsy)

Optional Dependencies

matplotlib: 3.0.2 (/usr/lib/python3/dist-packages/matplotlib)
backend: TkAgg
cvxopt: Not installed
joblib: 0.13.0 (/usr/lib/python3/dist-packages/joblib)

Developer Tools

IPython: 7.5.0 (/home/pietro/.local/lib/python3.7/site-packages/IPython)
jinja2: 2.10.1 (/home/pietro/.local/lib/python3.7/site-packages/jinja2)
sphinx: 1.8.4 (/usr/lib/python3/dist-packages/sphinx)
pygments: 2.4.2 (/home/pietro/.local/lib/python3.7/site-packages/pygments)
pytest: 4.6.3 (/home/pietro/.local/lib/python3.7/site-packages)
virtualenv: 15.1.0 (/usr/lib/python3/dist-packages)

Activity

  1. self-assigned this
    on Jun 28, 2020
  2. added a commit that references this issue on Jun 28, 2020
    41260e6
  3. added this to the 0.12 milestone on Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions