Open JudithBernett opened 3 years ago
Hey @JudithBernett ,
I have a similar question. How did you resolve this issue?
-Todd
Hey @tdfy , unfortunately, we could not resolve this issue and therefore just allowed one condition in our application. If you find out, please let us know! -Judith
In my dataset, I have 2 conditions I would like to analyse:
All of the patients have a baseline measurement and a measurement that was done after stimulation. I want to compare the stimulation condition within each treatment group and between the treatment groups. For this, I would like to compare the results of the implemented methods for differential abundance and differential states but I am unsure if I understand correctly, how the contrast matrix has to be specified.
Case 1: Let's say I wanted to run edgeR on this. I would first create a design matrix with my two conditions like this:
createDesignMatrix(experiment_info, cols_design = c("treatment", "stimulation", "patient_id"))
which yields the columns: "(Intercept)", "treatmentB", "treatmentC", "stimulationAfter", "patient_idP2", ..., "patient_idP10". Should I create my contrast matrix then withcreateContrast( c( 0, 1, 1, 1, rep(0, 9) ) )
?Case 2: Let's say I now wanted run a GLMM for comparison. For the GLMM, I would specify my formula with:
createFormula(experiment_info, cols_fixed = c("treatment", "stimulation"), cols_random = "patient_id")
. Now, my contrast has to correspond to the levels of my fixed effect terms. Should I therefore specify the contrast matrix with:createContrast( c(1, 1, 1, 1, 1) )
or does the first entry have to be a zero:createContrast( c(0, 1, 1, 0, 1) )
to get a meaningful analysis?Would this contrast matrix lead to an all-against-all comparison, i.e. every treatment group in every stimulation condition? If I then wanted to compare the different treatment groups only in the baseline stimulation group, what contrast do I have to specify?
Another thing that confuses me is that Wikipedia says that the coefficients of contrast add up to zero. However, in your examples in
diffcyt workflow
and in?createContrast
this is not the case. Is this done internally?Thank you for your time!