-
Notifications
You must be signed in to change notification settings - Fork 57
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
Support for passing hypothesis to doLRT in summary() as in lrTest() #171
Comments
While you are welcome to submit a PR, it's not going to be a priority for me to extend summary in this way.
Workaround is to just call lrTest with your coefficients and combine by hand. |
@amcdavid Thanks for the quick reply! I do realize that this can be complicated as I further explored the manual combine approach. I would like to ask a little more in this line -- just want to make sure I get things correct when I implement my own workaround. I noticed that Thanks again for providing and wonderfully maintaining this useful package. If I will ever manage to get a confident understanding of the inner workings of the package I'll be glad to try a PR:) |
I probably need an example here to understand what you are referring to.
What do you mean by |
I'll try to explain with a toy example. For a "real" single-cell RNA-seq dataset there will be of course a lot more samples (cells). First consider a simple one-way design of a factor named
And in
But then consider, a repeated measure design involving paired
The issue with this case is that for Given this context, when I said
Hopefully I am not missing anything and this makes sense. Thanks again for your time. |
Yes -- that is for better or worse intrinsic to the model. The former quantity (log fold change of the average effect) is going to be different than the average of the log fold change. A workaround might be to stratify into 3 groups, calculate the log-fold change in each group, then average those -- you could propagate error by just summing the variances and dividing by the number of summands squared (eg 9 in your example) because the estimates will be independent (in the statistical sense) from each other. From a "multifactorial ANOVA" standpoint, if you are fitting an interaction model (between individual and treatment), does it make sense to interpret an average effect? Some people say not. |
@amcdavid Thanks for the suggestions. I can see that it's tricky to accommodate for a general case in the computation of logFC. I guess this issue can now be closed.
Yep sure I agree that if the interaction effect is non-trivial then averaging the main effect is probably not meaningful or informative. This is an independent data analysis consideration though, but points well taken and thanks for mentioning this. |
This is a (hopefully) minor feature request.
I am using the development version of the package.
lrTest
supports passing numerous different types of objects for the argumenthypothesis
, according to the document: "hypothesis
can be one of a character giving complete factors or terms to be dropped from the model,CoefficientHypothesis
giving names of coefficients to be dropped,Hypothesis
giving contrasts using the symbolically, or a contrast matrix." However, when called viasummary(zlmfit, doLRT)
, thedoLRT
argument can only be a character vector of coefficients to drop in the reduced model. It would be very helpful to also support the multiple argument types fordoLRT
insummary
as those forhypothesis
inlrTest
.My use case is as follows: I was exploring a series of somewhat complex nested design models, and I was not confident that I got the design matrix correct every time. After considering the experimental designs and questions of interests, I decided to instead create a new factor for combinations of all levels of the factors under consideration, provide an intercept-free model including only this new factor to
zlm
, and then obtain log fold-change values for a customized comparison viagetLogFC(zlmfit, contrast0, contrast1)
specifying both thecontrast0
andcontrast1
arguments. I was able to include such customized logFC insummary
viasummary(zlmfit, logFC=getLogFC(zlmfit, contrast0, contrast1))
, and I also wanted to perform LR test to get P values exactly corresponding to the customized comparison. But with the currentdoLRT
argument only accepting a character vector of coefficients I was not able to specify the test I needed.Thanks for your help.
The text was updated successfully, but these errors were encountered: