Add univariate vs multivariate model comparison #63
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.
Implements simultaneous construction and side-by-side comparison of univariate (each predictor separately) and multivariate (all predictors together) regression models, similar to autoReg package functionality.
Changes
br_compare_models(): Builds both model types in one call, returnsbreg_comparisonobject with combined results tagged by modebr_show_forest_comparison(): Renders forest plot with univariate and multivariate estimates grouped by variableprint.breg_comparison(): S3 print method for comparison objectsUsage
The forest plot displays each variable's estimates from both models, showing how effects change when adjusted for other predictors (e.g., ph.karno: HR=0.988, p=0.04 univariate → HR=1.02, p=0.11 multivariate).
Works with all model types (Cox, logistic, linear) and handles continuous/categorical variables. Added 12 tests covering various scenarios.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.