Skip to content

BUG graphics influence plot, switched criterion - #3158

Merged
josef-pkt merged 6 commits into
statsmodels:masterfrom
josef-pkt:bug_influence_plot_3103
Aug 15, 2016
Merged

josef-pkt merged 6 commits into
statsmodels:masterfrom
josef-pkt:bug_influence_plot_3103

Conversation

@josef-pkt

@josef-pkt josef-pkt commented Aug 14, 2016 •

Copy link
Copy Markdown
Member

closes #3103

I added a unit test to compare the sizes used in the plot, but it uses a matplotlib figure private attribute _sizes. This is most likely not robust, and might need to be try except AttributeError protected

I used matplotlib '1.5.1', and tests pass on my computer (only for the test method, I still get segfaults running the test class)

Detail (as explanation to test code): the plotted sizes are a affine transformation of the influence criterion, so I check that the residuals of the linear regression are close to zero.

@josef-pkt

Copy link
Copy Markdown
Member Author

the test doesn't seem to work with any of the matplotlib used on travis, i.e. <1.5

possible problem with try...except catching is that the unit test might never run at all.
(We need more robust unit tests for content of plots)

@josef-pkt

Copy link
Copy Markdown
Member Author

maintenance, some test methods create several plots but don't close them
If I close all of them immediately, then I don't get a segfault anymore when running the unit tests.

https://travis-ci.org/statsmodels/statsmodels/jobs/152251848

statsmodels.graphics.tests.test_regressionplots.TestPlotPandas.test_plot_oth ... /home/travis/miniconda2/envs/statsmodels-test/lib/python2.7/site-packages/matplotlib/pyplot.py:412: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_num_figures`).
  max_open_warning, RuntimeWarning)
ok

I still get tkinter warnings in TestPlot.test_plot_oth unless I comment out the add_lowess loop. I still don't see where this comes from.

statsmodels.graphics.tests.test_regressionplots.TestPlot.test_plot_oth ... can't
 invoke "event" command: application has been destroyed
    while executing
"event generate $w <<ThemeChanged>>"
    (procedure "ttk::ThemeChanged" line 6)
    invoked from within
"ttk::ThemeChanged"
can't invoke "event" command: application has been destroyed
    while executing
"event generate $w <<ThemeChanged>>"
    (procedure "ttk::ThemeChanged" line 6)
    invoked from within
"ttk::ThemeChanged"
can't invoke "event" command: application has been destroyed
    while executing
"event generate $w <<ThemeChanged>>"
    (procedure "ttk::ThemeChanged" line 6)
    invoked from within
"ttk::ThemeChanged"
ok

@josef-pkt
josef-pkt force-pushed the bug_influence_plot_3103 branch from 78fdab3 to 2f54d07 Compare August 15, 2016 00:00
@coveralls

coveralls commented Aug 15, 2016 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+9.0e-05%) to 89.184% when pulling 2f54d07 on josef-pkt:bug_influence_plot_3103 into 92da1cd on statsmodels:master.

@josef-pkt

josef-pkt commented Aug 15, 2016 •

Copy link
Copy Markdown
Member Author

test_power is the last one, the entire test suite runs now for me also.
quite a bit faster than Travis 516.624 / 60 = 8.6104 minutes
(single core nosetests, but MKL uses multicore, max cpu usage around 50% with 4 core/8 logical processors when running the tests for statsmodels.regression)

Ran 4890 tests in 516.624s
FAILED (SKIP=35, errors=2)

(second error is in an extra file, that was left over from a different branch)

@josef-pkt

Copy link
Copy Markdown
Member Author

some cosmetic changes would be possible, but in it goes

@josef-pkt
josef-pkt merged commit a111886 into statsmodels:master Aug 15, 2016
@josef-pkt josef-pkt mentioned this pull request Aug 16, 2016
4 of 28 tasks
@josef-pkt
josef-pkt deleted the bug_influence_plot_3103 branch August 17, 2016 15:17
josef-pkt added a commit to josef-pkt/statsmodels that referenced this pull request Aug 19, 2016
…_3103

BUG graphics influence plot, switched criterion
@TomAugspurger TomAugspurger mentioned this pull request Feb 2, 2017
2 tasks done
@josef-pkt josef-pkt added the type-bug-wrong serious bugs that silently return incorrect numbers label Feb 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-graphics comp-regression type-bug type-bug-wrong serious bugs that silently return incorrect numbers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logic swapped for cooks distance/dffits in influence_plot?

2 participants