Skip to content

ENH: family: add option to turn of valid link check, or warn. - #1880

Closed
josef-pkt wants to merge 2 commits into
statsmodels:mainfrom
josef-pkt:REF_genmod_link_check
Closed

josef-pkt wants to merge 2 commits into
statsmodels:mainfrom
josef-pkt:REF_genmod_link_check

Conversation

@josef-pkt

Copy link
Copy Markdown
Member

see #1509

add option: invalid_link : string in ['raise' 'warn', 'ignore'] to turn exception into warning or ignore

needed to allow the GLM equivalent for Probit in #1870
#1509 also includes other options to improve how links are specified, that are not addressed here.

Also, binomial should allow probit and CDFLink, which are also not included here.

@josef-pkt josef-pkt added this to the 0.6 milestone Aug 11, 2014
@josef-pkt

Copy link
Copy Markdown
Member Author

@kshedden This will also change which links can be used in GEE by turning off the exception.

@josef-pkt

Copy link
Copy Markdown
Member Author

test failure in GEE Multinomial (I only ran test_glm.py locally)

======================================================================

ERROR: statsmodels.genmod.tests.test_gee.TestGEE.test_nominal
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/statsmodels-0.6.0-py2.7-linux-x86_64.egg/statsmodels/genmod/tests/test_gee.py", line 522, in test_nominal
family = Multinomial(3)
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/statsmodels-0.6.0-py2.7-linux-x86_64.egg/statsmodels/genmod/generalized_estimating_equations.py", line 1946, in __init__
self.link = MultinomialLogit(self.ncut)
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/statsmodels-0.6.0-py2.7-linux-x86_64.egg/statsmodels/genmod/families/family.py", line 59, in _setlink
invalid_link = self.invalid_link
AttributeError: 'Multinomial' object has no attribute 'invalid_link'

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.02%) when pulling 723bdb8 on josef-pkt:REF_genmod_link_check into 2e806fc on statsmodels:master.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Won't this eventually fall down elsewhere if it's not a Link object?

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.

I only tried with some of our Links that were not registered as valid link, and didn't have any problem. (reproducing Probit but not using probit link)

User supplied links will still need to "quack" like a Link object.

@josef-pkt

Copy link
Copy Markdown
Member Author

about naming: invalid_link doesn't indicate that it is a flag, #2212 has safe_links as a list of links which sounds similar

@josef-pkt josef-pkt removed the PR label Jun 23, 2015
@josef-pkt josef-pkt modified the milestones: 0.8, 0.7 Jun 23, 2015
@josef-pkt josef-pkt modified the milestones: 0.8, 0.10 Apr 18, 2018
@josef-pkt josef-pkt mentioned this pull request Apr 18, 2018
1 task
@josef-pkt josef-pkt modified the milestones: 0.10, 0.14 Feb 14, 2022
@josef-pkt

Copy link
Copy Markdown
Member Author

aside:
CDFLink is valid for Binomial family because CDFLink is a subclass of Logit, so isinstance with Logit is true.

@josef-pkt

Copy link
Copy Markdown
Member Author

trying to rebase this
too many merge conflict, all __init__
__init__ was refactored in main since this PR was opened.

AFAICS, it will be faster starting a new PR from scratch instead of editing all merge conflicts

only planned change is to use check_link as keyword and flag.

@josef-pkt josef-pkt mentioned this pull request Dec 8, 2022
@josef-pkt josef-pkt added the superseded Used for PRs with content that is superseded by a newer PR label Dec 9, 2022
@josef-pkt

Copy link
Copy Markdown
Member Author

this is now in PR #8569

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

Labels

comp-genmod prio-elev superseded Used for PRs with content that is superseded by a newer PR type-enh type-refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants