Skip to content

ENH: Generalized linear mixed models (Bayesian) - #4189

Merged
kshedden merged 38 commits into
statsmodels:masterfrom
kshedden:glimmix
Mar 6, 2018
Merged

kshedden merged 38 commits into
statsmodels:masterfrom
kshedden:glimmix

Conversation

@kshedden

@kshedden kshedden commented Jan 3, 2018 •

Copy link
Copy Markdown
Contributor

This is a basic implementation of Bayesian mixed GLM (GLIMMIX). It is an alternative to using maximum likelihood that is somewhat easier to implement. Laplace approximations should work for any GLM, but the more sophisticated variational Bayes approach is only implemented here for logistic models right now. The VB approach is slow (5-10 minutes to fit a fairly complex model), but ML would also be slow for this problem.

Update: it's not particularly slow anymore, due to improvements in the implementation.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 82.127% when pulling 6012723 on kshedden:glimmix into 64dc3ea on statsmodels:master.

@josef-pkt

Copy link
Copy Markdown
Member

This pull request introduces 2 alerts - view on lgtm.com

new alerts:

  • 1 for Missing call to init during object initialization
  • 1 for Potentially uninitialized local variable

Comment posted by lgtm.com

@josef-pkt

Copy link
Copy Markdown
Member

travis test failures are not small.

I don't think I will have time to review this anytime soon except for spot checking or very superficial review.
I think we can merge this when you think it's ready.
However, I would prefer names that indicate that this is not one of our standard type of (frequentist) models, e.g. results does not inherit likelihood and wald inference. For example add a leading "B" to the name, "BMixedGLM". I think we should reserve the name MixedGLM for a frequentist version, even if it is numerically essentially the same but has our standard results.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 82.143% when pulling daf4d37 on kshedden:glimmix into 64dc3ea on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 82.143% when pulling daf4d37 on kshedden:glimmix into 64dc3ea on statsmodels:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 82.143% when pulling daf4d37 on kshedden:glimmix into 64dc3ea on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 82.143% when pulling daf4d37 on kshedden:glimmix into 64dc3ea on statsmodels:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.05%) to 82.139% when pulling 4416a7f on kshedden:glimmix into 64dc3ea on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.05%) to 82.139% when pulling 4416a7f on kshedden:glimmix into 64dc3ea on statsmodels:master.

@coveralls

coveralls commented Jan 5, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.05%) to 82.139% when pulling a565898 on kshedden:glimmix into 64dc3ea on statsmodels:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 82.142% when pulling 5991fef on kshedden:glimmix into 64dc3ea on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 82.142% when pulling 5991fef on kshedden:glimmix into 64dc3ea on statsmodels:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 82.144% when pulling 5991fef on kshedden:glimmix into 64dc3ea on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 82.144% when pulling 5991fef on kshedden:glimmix into 64dc3ea on statsmodels:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 82.145% when pulling 2c74332 on kshedden:glimmix into 64dc3ea on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 82.145% when pulling 2c74332 on kshedden:glimmix into 64dc3ea on statsmodels:master.

@coveralls

coveralls commented Jan 5, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 82.143% when pulling a649f91 on kshedden:glimmix into 64dc3ea on statsmodels:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.07%) to 82.157% when pulling 44fdcff on kshedden:glimmix into 64dc3ea on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.07%) to 82.157% when pulling 44fdcff on kshedden:glimmix into 64dc3ea on statsmodels:master.

@coveralls

coveralls commented Jan 6, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.07%) to 82.155% when pulling 390d9c2 on kshedden:glimmix into 64dc3ea on statsmodels:master.

@coveralls

coveralls commented Jan 6, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 82.181% when pulling ac733d1 on kshedden:glimmix into 64dc3ea on statsmodels:master.

@josef-pkt

Copy link
Copy Markdown
Member

This pull request introduces 1 alert - view on lgtm.com

new alerts:

  • 1 for Redundant assignment

Comment posted by lgtm.com

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.09%) to 82.179% when pulling f15f939 on kshedden:glimmix into 64dc3ea on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.09%) to 82.179% when pulling f15f939 on kshedden:glimmix into 64dc3ea on statsmodels:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 82.18% when pulling 25ec89c on kshedden:glimmix into 64dc3ea on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 82.18% when pulling 25ec89c on kshedden:glimmix into 64dc3ea on statsmodels:master.

@josef-pkt

Copy link
Copy Markdown
Member

This pull request introduces 3 alerts - view on lgtm.com

new alerts:

  • 2 for Signature mismatch in overriding method
  • 1 for Mismatch between signature and use of an overridden method

Comment posted by lgtm.com

@coveralls

coveralls commented Jan 7, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 82.179% when pulling 25ec89c on kshedden:glimmix into 64dc3ea on statsmodels:master.

return summ


class BinomialBayesMixedGLM(_VariationalBayesMixedGLM, _BayesMixedGLM):

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.

currently _VariationalBayesMixedGLM already subclasses _BayesMixedGLM and is not an extra Mixin, just regular inheritance

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed

@coveralls

coveralls commented Jan 7, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 82.179% when pulling 6407cf6 on kshedden:glimmix into 64dc3ea on statsmodels:master.

@kshedden

kshedden commented Mar 6, 2018

Copy link
Copy Markdown
Contributor Author

I'm going to go ahead and merge this now. I will add support for scale parameters in a separate PR.

@kshedden
kshedden merged commit 660610f into statsmodels:master Mar 6, 2018
@josef-pkt josef-pkt mentioned this pull request Apr 9, 2018
@josef-pkt josef-pkt added this to the 0.9 milestone Apr 15, 2018
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.

4 participants