makeContrastsDream for Interaction
0
0
Entering edit mode
abadgerw • 0
@5088ef59
Last seen 7 hours ago
United Kingdom

I am interested in the interaction between a stimulation of various cell lines and a specific genotype. I am particularly interested in the following contrasts:

  1. Differences between genotypes without stimulation (both Con HLA Pos vs Con HLA Neg and PDL HLA Pos vs PDL HLA Neg conditions)
  2. Differences between genotypes with stimulation (Fib HLA Pos vs Fib HLA Neg)

Therefore, I planned to run an interaction model like this:

form <- ~ 0 + HLA*Stim + (1 | ID)

However, I am stuck on how to setup contrasts for this more complex model. I'm sharing my metadata here for reference: enter image description here

Any insight into the call I can make to makeContrastsDream for this interaction analysis? I looked at the examples provided online for making contrasts but didn't see an example with an interaction to follow.

limma DifferentialExpression variancePartition dream • 414 views
ADD COMMENT
1
Entering edit mode

The simplest way to handle contrasts with an interaction term is to create a new variable. Lets consider a simpler case with variables Sex with levels F and M, and Age with levels Young and Old:

df = expand.grid(Sex = c("F", "M"), Age = c("Young", "Old"))

# interaction term 
df$Inter = with(df, paste(Sex, Age, sep="_"))
df
#>   Sex   Age   Inter
#> 1   F Young F_Young
#> 2   M Young M_Young
#> 3   F   Old   F_Old
#> 4   M   Old   M_Old

Instead of defining your interaction term in the formula, you can define a new variable explicitly. Then you can use formula ~ 0 + Inter + .... You can then define contrasts using levels F_Young and M_Young:

df = expand.grid(Sex = c("F", "M"), Age = c("Young", "Old"))

library(variancePartition)

form = ~ 0 + Inter
makeContrastsDream( form, df, 
        contrasts = c(example = "InterF_Young - InterM_Young"))
#>               Contrasts
#> Levels         example
#>   InterF_Old         0
#>   InterF_Young       1
#>   InterM_Old         0
#>   InterM_Young      -1
ADD REPLY
0
Entering edit mode

Thank you! I will try this out.

ADD REPLY
0
Entering edit mode

gabriel.hoffman any insight?

ADD REPLY

Login before adding your answer.

Traffic: 942 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6