-
Notifications
You must be signed in to change notification settings - Fork 14
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
Overhaul of contrast code #32
Overhaul of contrast code #32
Conversation
The new implementation does not actually fit a dummy model in order to extract the fixed effect names, but rather copies the logic in lme4::lFormula to construct the same fixed effects model matrix that lmer will use and return the column names.
The new implementation simply uses diag to generate the univariate contrast matrix, and then sets the dimnames appropriately.
Since .getContrastInit no longer throws errors on rank deficiency, isRunableFormula needs to check this on its own.
This is the dream equivalent of limma::makeContrasts, and should support all the same syntax for arbitrarily complex contrasts involving any number of coefficients.
Side note: what tab width/indent level do you use when editing R code? I'll adjust my contributions to match that. |
I use the defaults in sublime, so whatever you see in the GitHub code is fine. Let me know when I should merge your commit
…________________________________
From: Ryan C. Thompson ***@***.***>
Sent: Friday, April 30, 2021 8:27 AM
To: GabrielHoffman/variancePartition ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [GabrielHoffman/variancePartition] Overhaul of contrast code (#32)
USE CAUTION: External Message.
Side note: what tab width/indent level do you use when editing R code? I'll adjust my contributions to match that.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_GabrielHoffman_variancePartition_pull_32-23issuecomment-2D830058981&d=DwMCaQ&c=shNJtf5dKgNcPZ6Yh64b-A&r=KdYcmw5SdXylMrTGSuNVkNJulowod64k0PTDC5BHZkk&m=OHpWm_9PoZwUTm8j916ZSbq7x6wDCQzB5sxLNtNL0Kk&s=wk9CCSxvAF7EKuwQxXWMjpsQ9Ut4qwlRwsiOXrNrEN4&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ADFAXTLZLRLBQRQ2CIUJYQ3TLKO2JANCNFSM434DWEYA&d=DwMCaQ&c=shNJtf5dKgNcPZ6Yh64b-A&r=KdYcmw5SdXylMrTGSuNVkNJulowod64k0PTDC5BHZkk&m=OHpWm_9PoZwUTm8j916ZSbq7x6wDCQzB5sxLNtNL0Kk&s=MG1Ns0FzbkgnCx9i2NO2PcMjR6GIm70Iptsm27fY3Uc&e=>.
|
Note, these changes should all be backward-compatible, but I haven't thoroughly checked that. |
@DarwinAwardWinner can you add an example to this code since it is exported but its not clear how to use it variancePartition/R/fitMixedModelDE.R Line 173 in fcaec42
|
I have reimplemented the various contrast functions (
getContrast
,.getContrastInit
, etc.) as well as added a new functionmakeContrastsDream
, which is designed to work likelimma::makeContrasts
. Note that since.getContrastInit
no longer actually runslmer
, it no longer throws errors for things like rank-deficient designs. If this is undesirable, I can add those checks back in.I still need to add documentation and do some testing before this is ready to merge, but I'm putting it up now so you can look at it.