Support for multiarm ancova, Draft v2 - #590
Open
luwidmer wants to merge 36 commits into
Open
Conversation
- use correct cluster in test - make sure no left over .stan files after tests - import stats::plogis
Closes #529
This adds spell-check and fixes a bunch of spelling mistakes (see #544). In addition, NMAR and MNAR are consistently called MNAR. However, one of the exported arguments is also `nmar.rm`, which I renamed to `mnar.rm` here - this will need an additional pull request adding the lifecycle package (#188) and deprecating the old argument --------- Signed-off-by: Lukas Widmer <l.widmer@gmail.com> Co-authored-by: Lukas Widmer <lukas_andreas.widmer@novartis.com>
Signed-off-by: Lukas Widmer <l.widmer@gmail.com> Co-authored-by: Lukas Widmer <lukas_andreas.widmer@novartis.com> Co-authored-by: Isaac Gravestock <83659704+gravesti@users.noreply.github.com>
Fixes #557 --------- Co-authored-by: Lukas Widmer <lukas_andreas.widmer@novartis.com>
Fixes #550 --------- Signed-off-by: Lukas Widmer <l.widmer@gmail.com> Co-authored-by: Lukas Widmer <lukas_andreas.widmer@novartis.com>
Merge remote-tracking branch 'origin/main' into 145-multi-ancova # Conflicts: # vignettes/FAQ.html # vignettes/quickstart.html
Fixes #567 --------- Co-authored-by: Lukas Widmer <lukas_andreas.widmer@novartis.com>
Addsmissing example code for exported functions, where possible this is based on the existing code from the quick start and advanced vignettes. Fixes #570 --------- Co-authored-by: Lukas Widmer <lukas_andreas.widmer@novartis.com>
Fixes #572 --------- Co-authored-by: Lukas Widmer <lukas_andreas.widmer@novartis.com>
Fixes #583 --------- Co-authored-by: Lukas Widmer <lukas_andreas.widmer@novartis.com>
Fixes #578 --------- Co-authored-by: Lukas Widmer <lukas_andreas.widmer@novartis.com>
Fixes #574 --------- Co-authored-by: Lukas Widmer <lukas_andreas.widmer@novartis.com>
Fixes #576 --------- Co-authored-by: Lukas Widmer <lukas_andreas.widmer@novartis.com>
Merge branch 'main' into 145-multi-ancova-v2 # Conflicts: # DESCRIPTION # NEWS.md # man/control.Rd # vignettes/advanced.html # vignettes/quickstart.html
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.
First draft to further iterate onaccording to to the discussion in #520 so far @gowerc @tobiasmuetze @bailliem @wwojciech @danielinteractive: this branch builds on the original multi-arm ANCOVA prototype (#520 ) with a more flexible contrast API.
Let me know what you think, this definitely will need further review and iteration.
Flexible custom contrasts
group_contrastsnow accepts, in addition to pairwisec(minuend, subtrahend)character vectors, general linear contrasts as named numeric weight vectors over the group levels (e.g.c(Placebo = -1, A = 0.5, B = 0.5)for pooled active-vs-control, or dose-response trends). Weights must sum to zero; evaluation is coding-agnostic and preserves thetrtestimand (evaluated at the covariate reference).trt,lsm_ref,lsm_alt,trt_alt2, ...).Correctness & robustness
ancova_linear_contrast()now maps group-level weights onto the model coefficients via the factor's own contrast matrix instead of parsingrbmiGroupL*coefficient names. Results are correct under anyoptions("contrasts")(e.g.contr.sum), not justcontr.treatment, and reduce exactly to the previous coefficient contrast for the pairwise/default case. Rank-deficient designs (missing/aliased/NAgroup coefficients) now error instead of silently dropping a term.as_data_frame_internal()errors if pooled parameters have no matching metadata rather than emitting silentNAcolumns.Named contrasts & output metadata
parameterand a newcontrast_labelmetadata column (surfaced bypool()/as.data.frame()). The auto-derivedtrt_alt2_alt-style names are used only for the default (group_contrasts = NULL) set, preserving backward compatibility. Naming a contrasttrtreproduces the classic name.lsm_are rejected (reserved for least-squares means) to prevent output collisions.pool()/as.data.frame()output gainscontrast_labelalongside the existingestimate_type,group,group_level_1,group_level_2,visitcolumns; the legacyparametercolumn is retained.Documentation
ancova()@return(now documents the extended default scheme and named custom contrasts); added an@detailsnote clarifying thattrtis the model-coefficient contrast and differs fromlsm_alt − lsm_refunder group×covariate interactions.ancova()and worked pairwise + weight-vector blocks to the FAQ and quickstart vignettes.Tests
contr.suminvariance, named-label propagation throughpool(), reserved-name and validation errors, an end-to-endancova()→pool()→as.data.frame()metadata integration test.Housekeeping
air.Compatibility
group_contrastsand the metadata columns are new (unreleased), so tightening explicit contrasts to require names introduces no break for released behaviour.trtis fixed at 0 to preserve the historic estimand (documented in@details).