Skip to content

BUG/ENH: Two bug fixes and several enhancements to knockoff filter (regression fdr) - #4920

Merged
kshedden merged 5 commits into
statsmodels:masterfrom
kshedden:ko_bug
Aug 23, 2018
Merged

kshedden merged 5 commits into
statsmodels:masterfrom
kshedden:ko_bug

Conversation

@kshedden

@kshedden kshedden commented Aug 16, 2018 •

Copy link
Copy Markdown
Contributor

Bugs:

  • Forgot to combine the real and knockoff features in init

  • Modifying exog in-place leads to incorrect scaling

New tests

Enhancements

  • Summary method

  • Provide Knockoff+ (guaranteed to control FDR but slightly conservative) as well as Knockoff FDR

  • New RegModelEffects allows the user to specify which model is used for parameter estimation

import pandas as pd
from statsmodels.compat.numpy import np_new_unique

from statsmodels.iolib import summary2

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.

One more newline after this pls

"""

def __init__(self, model, regularized=False, reg_kws=None):
self.model = model

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.

model is used elsewhere to denote a Model instance. For consistency, maybe call this model_cls?


y = np.random.normal(size=n)
x = np.random.normal(size=(n, p))
for p in 49, 50:

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.

brackets around 49,50

x = np.random.normal(size=(n, p))

for method in "equi", "sdp":
testers = [kr.CorrelationEffects(),

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.

Would it make sense to use pytest.mark.parametrize here?

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 83.928% when pulling 59724cf on kshedden:ko_bug into 9b37f1b on statsmodels:master.

@coveralls

coveralls commented Aug 18, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.004%) to 83.868% when pulling d777557 on kshedden:ko_bug into 66fc298 on statsmodels:master.

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #4920 into master will increase coverage by 0.01%.
The diff coverage is 90.9%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4920      +/-   ##
==========================================
+ Coverage   81.34%   81.35%   +0.01%     
==========================================
  Files         581      581              
  Lines       90053    90084      +31     
  Branches    10087    10088       +1     
==========================================
+ Hits        73253    73289      +36     
+ Misses      14506    14501       -5     
  Partials     2294     2294
Impacted Files Coverage Δ
statsmodels/stats/knockoff_regeffects.py 100% <100%> (ø) ⬆️
...smodels/genmod/generalized_estimating_equations.py 82.76% <60%> (+0.01%) ⬆️
statsmodels/stats/_knockoff.py 66.97% <86.95%> (+4.75%) ⬆️
statsmodels/stats/tests/test_knockoff.py 81.81% <94.28%> (-3.19%) ⬇️
statsmodels/regression/mixed_linear_model.py 89.77% <0%> (+0.79%) ⬆️

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 66fc298...d777557. Read the comment docs.

@kshedden
kshedden merged commit 53f5c5d into statsmodels:master Aug 23, 2018
@josef-pkt josef-pkt added this to the 0.10 milestone Sep 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants