Entering edit mode
5 months ago
Daniel
▴
10
Hi all,
I am analyzing a dataset consisting of three groups and a control group. Let's call them Control, GroupA, GroupB, and GroupC. I am using a non-intercept model matrix that includes the group variable and a few technical variables that need to be controlled for.
Here is the R code I am using:
# Constructing the design matrix without intercept
design <- model.matrix(~0 + Groups + TechA + TechB + TechC, data = sample.info)
# Applying voom with quality weights
vwts <- voomWithQualityWeights(dge, design = design, plot = FALSE)
# Fitting the linear model
fit2 <- lmFit(vwts, design)
# Defining the contrasts to compare each group to the control
contrast.matrix <- makeContrasts(
GroupA_vs_Control = GroupsGroupA - GroupsControl,
GroupB_vs_Control = GroupsGroupB - GroupsControl,
GroupC_vs_Control = GroupsGroupC - GroupsControl,
levels = design
)
# Applying contrasts to the fit
fit2 <- contrasts.fit(fit2, contrast.matrix)
# Performing empirical Bayes moderation
fit2 <- eBayes(fit2)
res <- topTable(fit2, sort.by = "F", number = Inf, p.value = 0.1)
My question is: When I do this, am I testing the group effect while controlling for the variables TechA, TechB, and TechC?
Thank you very much!