Question: DESeq2: Second order interactions
0
gravatar for Pindre
8 months ago by
Pindre0
Pindre0 wrote:

I have a paired design, two groups, two time points and two conditions. Participants are nested within groups. Time points are nested within conditions.

Here it is:

group   ind.n   when    time
A   1   A   A
A   1   A   B
A   1   A   C
B   1   A   A
B   1   A   B
B   1   A   C
A   2   A   A
A   2   A   B
A   2   A   C
A   3   A   A
A   3   A   B
A   3   A   C
A   4   A   A
A   4   A   B
A   4   A   C
B   2   A   A
B   2   A   B
B   2   A   C
B   3   A   A
B   3   A   B
B   3   A   C
A   5   A   A
A   5   A   B
A   5   A   C
A   6   A   A
A   6   A   B
A   6   A   C
A   7   A   A
A   7   A   B
A   7   A   C
A   8   A   A
A   8   A   B
A   8   A   C
A   9   A   A
A   9   A   B
A   9   A   C
B   4   A   A
B   4   A   B
B   4   A   C
A   1   B   A
A   1   B   B
A   1   B   C
B   1   B   A
B   1   B   B
B   1   B   C
A   2   B   A
A   2   B   B
A   2   B   C
A   3   B   A
A   3   B   B
A   3   B   C
A   4   B   A
A   4   B   B
A   4   B   C
B   2   B   A
B   2   B   B
B   2   B   C
B   3   B   A
B   3   B   B
B   3   B   C
A   5   B   A
A   5   B   B
A   5   B   C
A   6   B   A
A   6   B   B
A   6   B   C
A   7   B   A
A   7   B   B
A   7   B   C
A   8   B   A
A   8   B   B
A   8   B   C
A   9   B   A
A   9   B   B
A   9   B   C
B   4   B   A
B   4   B   B
B   4   B   C
A   10  A   A
A   10  A   B
A   10  A   C
A   11  A   A
A   11  A   B
A   11  A   C
A   12  A   A
A   12  A   B
A   12  A   C
A   13  A   A
A   13  A   B
A   13  A   C
A   14  A   A
A   14  A   B
A   14  A   C
A   15  A   A
A   15  A   B
A   15  A   C
A   16  A   A
A   16  A   B
A   16  A   C
A   17  A   A
A   17  A   B
A   17  A   C
A   18  A   A
A   18  A   B
A   18  A   C
A   19  A   A
A   19  A   B
A   20  A   A
A   20  A   B
A   20  A   C
A   21  A   A
A   21  A   B
A   21  A   C
B   5   A   A
B   5   A   B
B   5   A   C
A   10  B   A
A   10  B   B
A   10  B   C
A   11  B   A
A   11  B   B
A   11  B   C
A   12  B   A
A   12  B   B
A   12  B   C
A   13  B   A
A   13  B   B
A   13  B   C
A   14  B   A
A   14  B   B
A   14  B   C
A   15  B   A
A   15  B   B
A   15  B   C
A   16  B   A
A   16  B   B
A   16  B   C
A   17  B   A
A   17  B   B
A   17  B   C
A   18  B   A
A   18  B   B
A   18  B   C
A   19  B   A
A   19  B   B
A   20  B   A
A   20  B   B
A   20  B   C
A   21  B   A
A   21  B   B
A   21  B   C
B   5   B   A
B   5   B   B
B   5   B   C

For group A: I want to test the difference of the difference:

(GroupA.WhenB.TimeB-GroupA.WhenB.TimeA) - (GroupA.WhenA.TimeB-GroupA.WhenA.TimeA)

For group B: then same thing:

(GroupB.WhenB.TimeB-GroupB.WhenB.TimeA) - (GroupB.WhenA.TimeB-GroupB.WhenA.TimeA)

Then, I want the difference between the difference of difference:

((GroupB.WhenB.TimeB-GroupB.WhenB.TimeA) - (GroupB.WhenA.TimeB-GroupB.WhenA.TimeA)) - ((GroupA.WhenB.TimeB-GroupA.WhenB.TimeA) - (GroupA.WhenA.TimeB-GroupA.WhenA.TimeA))

NB! Subject 19 is missing two libraries, one at for WhenA.TimeC and one at WhenB.TimeC.

So, how do I make my design matrix, correcting for paired samples? I have tried this:

full.m <- model.matrix(~ Group + Group:ind.n + Group:Time:When, dt.ss)
ss1 <- which(apply(full.m, 2, sum) == 0)
full.m <- full.m[,-ss1]
colnames(full.m)

library(caret)
findLinearCombos(full.m) # Remove linear combinations
full.m <- full.m[,-c(37:38)]

dds <- DESeqDataSetFromMatrix(countData = as.matrix(d.ss),
                              colData = dt.ss,
                              design = ~ 1)

dds <- DESeq(dds, full=full.m, parallel=TRUE, betaPrior=FALSE)

Questions:
1) How do I specify the wanted results?
2) Why did I have to remove terms 37 and 38? How do I now specify them?

Here an attempt:

results(dds, contrast=list("GroupB.timeB.whenB","GroupB.timeB.whenA"))

results(dds, contrast=list("GroupA.timeB.whenB","GroupA.timeB.whenA"))

Thus, I think I got the first order interactions. However, how do I get the second order interaction?:

results(dds, contrast=list(c("GroupB.timeB.whenB","GroupB.timeB.whenA"),  c("GroupA.timeB.whenB","GroupA.timeB.whenA")) ???????
deseq2 • 190 views
ADD COMMENTlink modified 7 months ago by Michael Love25k • written 8 months ago by Pindre0
Answer: DESeq2: Second order interactions
0
gravatar for Michael Love
7 months ago by
Michael Love25k
United States
Michael Love25k wrote:

hi,

You have a complex experimental design, and so I would strongly recommend you to collaborate with a statistician on how to set up the design and how to combine coefficients using the design formula and coefficients that R produces.

I think you need all the interactions here, e.g. if you didn't have individual, you would use

~group + cond + time + cond:time + group:cond + group:time + group:cond:time

This gives all the standard interactions you would expect, and the last coefficient is the difference in the interaction across group.

ADD COMMENTlink written 7 months ago by Michael Love25k

Thats great! But "if you DO have individual"? Thanks.

ADD REPLYlink written 3 months ago by Pindre0

I'd highly recommend discussing with a statistician. With a complex design like this, with repeated measures and three interacting covariates, I would typically meet with a local investigator to discuss analysis plans and assumptions face-to-face, including the entire team. It's not just getting the software to run but also how are you going to interpret the results and write up the analysis, etc.

ADD REPLYlink written 3 months ago by Michael Love25k

Thats great! But "if you DO have individual"? Thanks.

ADD REPLYlink written 3 months ago by Pindre0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 288 users visited in the last hour