Closed Tang-RH closed 5 months ago
Hi @Tang-RH try swapping the position of Transplant
and Batch
around in the model matrix formula.
Thank you so much for your prompt response! I tried it and it worked. I have a quick follow-up question: does the order of covariates in the model matrix formula matter?
Yes, this seems to be a quirk of model.matrix
that I've never been able to figure out. In testNhoods
(without constrasts) the last variable in the formula is taken as the test variable. Contrasts alter that behaviour, so it should be noted in the documentation clearly - I will add to the to-do list.
Thank you for developing miloR, a powerful tool for performing DA. I'm attempting to conduct DA across multiple conditions using data from different batches, and I've been following the guidance in the using contrasts tutorial. Here's my design dataframe:
the Transplant column contains 4 levels ('Healthy','Diagnosis','1st','Transplant'), and the
Batch
column contains 3 levels (B1,B2,B3), I attempted to run the testNhoods as follows:However, I encountered an error:
The error is similar to the issue #101, which suggests adding a '0' ahead the design fomula to make all level present on the model matrix. I implemented this fix, but when I constructed the model matrix manually:
I noticed that all three levels of the Batch column are present, but the first level of the Transplant column is missing. How can I perform a comparison between Healthy and Diagnosis with batch correction? Did I make mistake when using contrast with batch as covariate?