Skip to content

BUG/ENH: summary2, try param_names before exog_names - #4505

Merged
josef-pkt merged 2 commits into
statsmodels:masterfrom
josef-pkt:summary2_xnames
Apr 18, 2018
Merged

josef-pkt merged 2 commits into
statsmodels:masterfrom
josef-pkt:summary2_xnames

Conversation

@josef-pkt

Copy link
Copy Markdown
Member

closes #3324

This is trying a quickfix for summary2 to use param_names. It's similar to #3324 except for a try except protection.
summary_col doesn't work with MixedLM which uses summary2 for summary()

Note: summary also only uses model.exog_names, which I don't change here.

Bigger issue (not now) settle the param_names/exog_names pattern, #4426

@coveralls

coveralls commented Apr 18, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.01%) to 82.772% when pulling 94098c4 on josef-pkt:summary2_xnames into 9eebbfa on statsmodels:master.

@codecov-io

codecov-io commented Apr 18, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #4505 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4505      +/-   ##
==========================================
+ Coverage   80.14%   80.15%   +0.01%     
==========================================
  Files         560      560              
  Lines       84613    84632      +19     
  Branches     9572     9572              
==========================================
+ Hits        67810    67840      +30     
+ Misses      14587    14580       -7     
+ Partials     2216     2212       -4
Impacted Files Coverage Δ
statsmodels/regression/tests/test_lme.py 86.68% <100%> (+0.37%) ⬆️
statsmodels/iolib/summary2.py 90.81% <100%> (+3.73%) ⬆️
statsmodels/stats/descriptivestats.py 24.13% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9eebbfa...94098c4. Read the comment docs.

@josef-pkt

Copy link
Copy Markdown
Member Author

travis is green, but some python took much longer.
I don't see why this should happen in these unit tests, but I will add start_params (amend and force push)
adding start_params changed 1 number in the last display decimal.

@josef-pkt

Copy link
Copy Markdown
Member Author

The python on travis that are slow before are around 10 minutes faster again (roughly 26 instead of 36).
No idea whether travis or the test case had a problem.

try:
data.index = results.model.data.param_names
except AttributeError:
data.index = results.model.exog_names

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable. Are there cases where param_names wont be right? (i.e. is the try/except even necessary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try except was necessary because without it 3324 had a test error in MICE.
A proper solution needs to wait. I could have added a quickfix in MICE instead but overall this needs more thinking about the design.

# hard coded simulated y
# ids = np.asarray(ids)
# np.random.seed(123987)
# y = x + np.array([-1, 0, 1])[ids - 1] + 2 * np.random.randn(len(y))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC the code above is equivalent to the code below? why bother with hard-coding below?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor speedup, and I needed to fix the case because for most seeds the optimization didn't converge properly (or ended up at corner or non-invertible hessian.)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants