Skip to content
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

Merged

Conversation

DarwinAwardWinner
Copy link
Contributor

I have reimplemented the various contrast functions (getContrast, .getContrastInit, etc.) as well as added a new function makeContrastsDream, which is designed to work like limma::makeContrasts. Note that since .getContrastInit no longer actually runs lmer, 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.

DarwinAwardWinner and others added 4 commits April 30, 2021 06:55
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.
@DarwinAwardWinner
Copy link
Contributor Author

Side note: what tab width/indent level do you use when editing R code? I'll adjust my contributions to match that.

@GabrielHoffman
Copy link
Owner

GabrielHoffman commented Apr 30, 2021 via email

@GabrielHoffman GabrielHoffman merged commit fcaec42 into GabrielHoffman:master Jul 28, 2021
@DarwinAwardWinner
Copy link
Contributor Author

Note, these changes should all be backward-compatible, but I haven't thoroughly checked that.

@GabrielHoffman
Copy link
Owner

@DarwinAwardWinner can you add an example to this code since it is exported but its not clear how to use it

makeContrastsDream = function (exprObj, formula, data, ..., contrasts) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants