**10**wrote:

Hi,

I'm analyzing a microarray data and stuck at the design matrix command.

I have few samples, in which I divided them into two groups i.e. "Controls" & "Diseased".

I assigned the samples information as a factor with two levels "C" & "D".

In what exact order should I assign the levels? If I assign levels as *C, D* then I get the logFC value as say **X **and if I do it as *D, C* I get the logFC value as **-X**.

Should I start with the diseased group (D) or control group (C)?

In default, in what exact order the design matrix take the levels?

My code is as follows:

info$Group<-factor(info$Group, levels=c(**"C","D"**))

# ^^^ Which one should I consider first in the above command? The diseased group or control group? ^^^

levels(info$Group)

lev<-levels(info$Group)

design<-model.matrix(~0+info$Group)

colnames(design)<-lev

dim(design)

head(design)

fit<-lmFit(exp, design)

names(fit)

contr.str <- c()

len<-length(lev)

for(i in 1:(len-1))contr.str<-c(contr.str, paste(lev[(i+1):len], lev[i], sep="-"))

contr.str

contr.mat<-makeContrasts(contrasts=contr.str, levels=lev)

fit2<-contrasts.fit(fit, contr.mat)

fit2<-eBayes(fit2)

names(fit2)

top <- topTable(fit2, number=nrow(fit2), adjust.method="fdr")

Thanks in advance

It doesn't matter computationally, but it makes more sense to use the control sample as your referent, so levels = c('C', 'D') is a bit more pragmatic.

4.2kThanks a lot :)

10