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

Better handling of constant response #578

Merged
merged 5 commits into from
Nov 11, 2021
Merged

Better handling of constant response #578

merged 5 commits into from
Nov 11, 2021

Conversation

palday
Copy link
Member

@palday palday commented Nov 10, 2021

For GLMM, this means allow constructing a model with a constant response.
This is useful for simulation.
For both GLMM and LMM, catch an initial PosDefException.
If the PosDefException is from a constant response, throw ArgumentError.

Technically this is a "feature" so I've done a minor version bump instead of patch.

For GLMM, this means allow constructing a model with a constant response.
This is useful for simulation.
For both GLMM and LMM, catch an initial PosDefException.
If the PosDefException is from a constant response, throw ArgumentError.
test/pls.jl Outdated Show resolved Hide resolved
@palday palday requested a review from dmbates November 10, 2021 22:40
@codecov
Copy link

codecov bot commented Nov 10, 2021

Codecov Report

Merging #578 (30fbe94) into main (9f27f2b) will decrease coverage by 0.02%.
The diff coverage is 90.00%.

❗ Current head 30fbe94 differs from pull request most recent head 8eca919. Consider uploading reports for the commit 8eca919 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main     #578      +/-   ##
==========================================
- Coverage   96.25%   96.22%   -0.03%     
==========================================
  Files          28       28              
  Lines        2509     2516       +7     
==========================================
+ Hits         2415     2421       +6     
- Misses         94       95       +1     
Impacted Files Coverage Δ
src/linearmixedmodel.jl 97.92% <80.00%> (-0.18%) ⬇️
src/generalizedlinearmixedmodel.jl 89.93% <100.00%> (+0.09%) ⬆️

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 9f27f2b...8eca919. Read the comment docs.

@palday
Copy link
Member Author

palday commented Nov 10, 2021

The drop in coverage is from the rethrow() lines when the PosDefException occurs without a constant response. I don't have a good pathological example for eliciting that handy.

Copy link
Collaborator

@dmbates dmbates left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for doing this.

Well, except for that test error thing.

@palday
Copy link
Member Author

palday commented Nov 10, 2021

@dmbates Yeah, it looks like subtle linear algebra differences lead to GLMM failing at an unexpected point for GLMM, so I've just moved to always testing for constant response in fit!(::GeneralizedLinearMixedModel). The test with any should exit pretty quickly for most datasets where the response is not constant; the big exception would be a dataset that had been sorted by the response ....

@palday
Copy link
Member Author

palday commented Nov 10, 2021

(The test should still be faster than trying to add error trapping into the objective evaluation.)

@palday palday merged commit abca4ea into main Nov 11, 2021
@palday palday deleted the pa/binconsant branch November 11, 2021 02:16
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.

2 participants