contrast matrix design for a continuous variable
1
0
Entering edit mode
dtzhu337 • 0
@f9182197
Last seen 3 hours ago
United States

Hi all,

I am trying to figure out signals from DNA methylation for a continuous variable at multiple groups. We have mice samples at 4 time points in both sexes, and we are testing if DNA methylation positions respond to V1 using limma

I used the following design matrix and added duplicateCorrelation for random effect. I am asking the following three questions:

  1. which DNA methylation positions respond to V1 in females?
  2. which DNA methylation positions respond to V1 in males?
  3. which DNA methylation positions respond to V1 differently between females and males?
V1 = meta_dat$variable
sex = meta_dat$sex
X = ns(meta_dat$time_point, df = 3)
design = model.matrix(~ 0 + sex + sex:V1 + X)

Q1: Does this design matrix make any sense?

The results from limma gave the following columns

colnames(coef(fit2))
[1] "sexfemale"       "sexmale"         "X1"              "X2"              "X3"             
[6] "sexfemale.V1" "sexmale.V1"

To answer the above questions,

  1. topTable(fit2, coef = 6, n = Inf, adjust.method = "BH")
    
  2. topTable(fit2, coef = 7, n = Inf, adjust.method = "BH")
    
  3. cont_sexdiff = makeContrasts(sexfemale.V1 - sexmale.V1,
                          levels = colnames(coef(fit2)))
    fit_cont = contrasts.fit(fit2, cont_sexdiff)
    fit_cont = eBayes(fit_cont)
    topTable(fit_cont, n = Inf, adjust.method = "BH")
    

Q2: Is my approach appropriate? Thank you.

limma • 146 views
ADD COMMENT
1
Entering edit mode
@gordon-smyth
Last seen 19 minutes ago
WEHI, Melbourne, Australia

Yes, the design and contrasts are correct.

Your analysis is also adjusted for covariates defined by X, which I assume is what you want to do.

ADD COMMENT
0
Entering edit mode

Thank you, Gordon. X is time splines for time point, and yes, it's needed.

However, I was also thinking to incorporate time point with sex, but the splines will no longer be available.

V1 = meta_dat$variable
sex = meta_dat$sex
tp = meta_dat$time_point
group = paste0(sex, "_", tp)
design = model.matrix(~ 0 + group + group:V1)

Which design will you recommend?

ADD REPLY

Login before adding your answer.

Traffic: 655 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