Refuse an all-NA additional covariate up front - #77
Merged
correspondMerchant merged 1 commit intoAug 10, 2026
Conversation
An additional covariate whose column is entirely NA made glm()'s internal na.omit drop every row, so the fit died with the opaque error "Error occurred during model fitting step: ... Argument mu must be a nonempty numeric vector", which never named the covariate. Unlike a collinear covariate, which glm() can drop and still fit (and which already warns), an all-NA covariate is always a mistake and can never enter the model. validate_inputs() now refuses it up front, after the column-existence check, naming the offending covariate(s) in one error. all(is.na(col)) catches an all-NA column of any type (numeric, factor, character). No previously successful run changes; the check is narrow (a partially-observed covariate is untouched). Adds end-to-end and unit tests: the refusal fires and names the covariate, catches all-NA factor/character columns, and stays silent on some-NA and fully-observed covariates. The end-to-end test asserts the clear message replaces the cryptic model-fitting error and fails on the prior source.
correspondMerchant
deleted the
fix/validate-all-na-additional-covariate
branch
August 10, 2026 17:50
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.
An additional covariate whose column is entirely NA made glm()'s internal na.omit drop every row, so the fit died with the opaque error "Error occurred during model fitting step: ... Argument mu must be a nonempty numeric vector", which never named the covariate. Unlike a collinear covariate, which glm() can drop and still fit (and which already warns), an all-NA covariate is always a mistake and can never enter the model.
validate_inputs() now refuses it up front, after the column-existence check, naming the offending covariate(s) in one error. all(is.na(col)) catches an all-NA column of any type (numeric, factor, character). No previously successful run changes; the check is narrow (a partially-observed covariate is untouched).
Adds end-to-end and unit tests: the refusal fires and names the covariate, catches all-NA factor/character columns, and stays silent on some-NA and fully-observed covariates. The end-to-end test asserts the clear message replaces the cryptic model-fitting error and fails on the prior source.