Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glm log log #7562

Closed
wants to merge 7 commits into from
Closed

Glm log log #7562

wants to merge 7 commits into from

Conversation

gmcmacran
Copy link
Contributor

@gmcmacran gmcmacran commented Jul 8, 2021

This pull requests adds the loglog link to the glm function for the binomial family.

Changes are
#1 Create class LogLog and loglog
#2 Edit binimial family to use #1's class
#3 Add Loglog to tests used for other links

In addition to automated tests, results were validated against R's extendedFamily package and example from Generalized Linear Models and Extensions book.

This is my first contribution to this repo. I attempted to follow https://www.statsmodels.org/stable/dev/index.html. Feedback/corrections are welcome.

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

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.

@pep8speaks
Copy link

pep8speaks commented Jul 8, 2021

Hello @gmcmacran! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-07-10 01:11:06 UTC

@@ -31,6 +32,8 @@ def get_domainvalue(link):
z = -np.log(np.random.uniform(0, 1))
if isinstance(link, links.CLogLog): # prone to overflow
z = min(z, 3)
elif isinstance(link, links.CLogLog):
Copy link
Member

Choose a reason for hiding this comment

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

you have CLogLog here, and not LogLog

@josef-pkt
Copy link
Member

Thanks, looks good.

some whitespace issues, you need to strip trailing whitespace.
I need to check before merging how much automatic test coverage we have for this.

@josef-pkt josef-pkt added this to the 0.13 milestone Jul 8, 2021
@josef-pkt
Copy link
Member

can you add inverse_deriv2? second derivative of inverse link
then we wouldn't have to compute it indirectly.

AFAIR, the plan is to have those also explicitly now.
I only added them to CDFLinks so far

@josef-pkt
Copy link
Member

Thanks, looks good now, unit tests are green

2 remaining pep-8 style check complaints
https://dev.azure.com/statsmodels/statsmodels-testing/_build/results?buildId=3498&view=logs&j=5999b18d-e094-51e5-d97a-d1e11af2567f&t=d028493a-5398-5672-bc8e-00ba508ef3fb
blank after (, and one line too long

Do you know how to squash commits in an interactive rebase?

@josef-pkt
Copy link
Member

Great, good to get this missing link added. Thanks again.

PR looks done

maybe squashing commits,
and I want to go over unit tests because I don't remember how they are structured for this.
otherwise looks ready to merge

@gmcmacran
Copy link
Contributor Author

Thanks, looks good now, unit tests are green

2 remaining pep-8 style check complaints
https://dev.azure.com/statsmodels/statsmodels-testing/_build/results?buildId=3498&view=logs&j=5999b18d-e094-51e5-d97a-d1e11af2567f&t=d028493a-5398-5672-bc8e-00ba508ef3fb
blank after (, and one line too long

Do you know how to squash commits in an interactive rebase?

Thanks for the help. I did some reading around squashing commits and changing the base. I think the safest thing is for you to do it if possible. I have stuck to the basics of version control. Is this possible? If not, I can make a practice repo and figure it out.

@gmcmacran
Copy link
Contributor Author

Been a few days. Checking in. Please advise if anything else needs to be done for this to be merged. Thanks.

@josef-pkt
Copy link
Member

Sorry, I was stuck in beta regression and didn't want to switch topics and branches before merging that.

@josef-pkt josef-pkt mentioned this pull request Jul 20, 2021
@josef-pkt
Copy link
Member

merged after rebase in #7562

@josef-pkt josef-pkt closed this Jul 20, 2021
@josef-pkt
Copy link
Member

Thanks @gmcmacran

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.

None yet

3 participants