Skip to content

TST: check and add unit tests - #8817

Open
jkriv wants to merge 2 commits into
statsmodels:mainfrom
jkriv:main
Open

jkriv wants to merge 2 commits into
statsmodels:mainfrom
jkriv:main

Conversation

@jkriv

@jkriv jkriv commented Apr 21, 2023

Copy link
Copy Markdown
  • closes #xxxx
  • tests added / passed.
  • code/documentation is well formatted.
  • properly formatted commit message. See
    NumPy's guide.
Details

Notes:

  • It is essential that you add a test when making code changes. Tests are not
    needed for doc changes.
  • When adding a new function, test values should usually be verified in another package (e.g., R/SAS/Stata).
  • When fixing a bug, you must add a test that would produce the bug in main and
    then show that it is fixed with the new code.
  • New code additions must be well formatted. Changes should pass flake8. If on Linux or OSX, you can
    verify you changes are well formatted by running
    git diff upstream/main -u -- "*.py" | flake8 --diff --isolated
    
    assuming flake8 is installed. This command is also available on Windows
    using the Windows System for Linux once flake8 is installed in the
    local Linux environment. While passing this test is not required, it is good practice and it help
    improve code quality in statsmodels.
  • Docstring additions must render correctly, including escapes and LaTeX.

ZeroInflatedGeneralizedPoisson: ['mean', 'var', 'prob', 'linear'],
ZeroInflatedNegativeBinomialP: ['mean', 'var', 'prob', 'linear'],
GeneralizedPoisson: ['mean', 'var', 'prob', 'linear'],
NegativeBinomial: ['mean', 'var', 'prob', 'linear']

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.

you are missing poisson here

@josef-pkt

Copy link
Copy Markdown
Member

looks good, let's see if it finds some bugs for this case


which_dict = {
Logit: ['mean', 'var', 'prob', 'linear'],
Probit: ['mean', 'var', 'prob', 'linear'],

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.

binary models don't have prob

if cls_model in which_dict:
# for each which, conduct smoke and shape test
for which in which_dict[cls_model]:
probs = res.predict(which=which, y_values=np.arange(5))

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.

you need to condition here on if which == "prob"
only "prob" uses y_values and returns 2-dim, others return 1-dim with length nobs = len(mod.endog)

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.

2 participants