Add check for perfect separation and some other tweaks#130
Merged
Conversation
1. **Model fitting** (numerator and denominator loops): before calling `model.passer()`, check `length(unique(y)) < 2`. If the outcome has no variation (all 0s or all 1s — the structural separation case), store a sentinel `list(skip = TRUE)` instead of fitting a model. 2. **Estimating loop**: check `isTRUE(model$skip)` before calling `inline.pred()`. If either the numerator or denominator model was skipped, assign `numerator = 1, denominator = 1` directly for that treatment level's rows — giving weights of 1, which is the correct answer when the treatment is structurally determined. 3. **Coefficient storage**: skip `clean_fastglm()` for sentinel models, storing `NULL` in the coefficient slot instead.
ryan-odea
approved these changes
Feb 25, 2026
Collaborator
ryan-odea
left a comment
There was a problem hiding this comment.
Hi Tom!
This looks good to me - good idea on adding in the perfect separation warning.
Just two comments (not necessary to address).
calculate.var, hazard.fixed.dist, hazard.time_varying.dist
fc3c716 to
256aa30
Compare
Collaborator
Author
Collaborator
Author
|
Turns out we are meant to commit the favicons in pkgdown/favicon into the repo - which I've just done - I've never been involved with a package with a logo before so didn't spot this until reading the pkgdown workflow warning message. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Hi Ryan
As I mentioned in our short course example we run across perfect separation - which (I guess to its credit) fastglm copes with - but it feels a bit dangerous that we don't warn folks - so I have included a check (I might have a go at putting this in the Python package in due course).
Also a few other fixes - I guess the 3 unused slots were features you might be planning to come back to??
internal.weights().internal.analysis()function now sets the number of data.table threads as specified bynthreads.SEQopts().