jeudi 9 février 2017

model.matrix and makeContrasts in R

Vote count: 0

I would like to do some contrasts in R. I have the following matrix with genes and expressions, called mat1:

   Gene1    Gene2   Gene3
1  5.89     7.45    2.66
2  8.99     5.39    1.58
3  3.67     6.88    4.82
4  8.25     8.76    3.58

I use the following code:

expression <- factor(mat1)
design <- model.matrix(~0 + expression)
colnames(design) <- levels(expression)

The design matrix looks now very strange. And the number of rows and columns has changed. Where is the mistake?

That's the code I would like to go on with:

fit <- lmFit(mat1, design)
contrast.matrix <- makeContrasts(Gen1 - Gen2, levels = design)
fit2 <- contrasts.fit(fit, contrast.matrix)
fit2 <- eBayes(fit2)

Is that the right way? Maybe anybody could help me.Thanks.

asked 24 secs ago

Let's block ads! (Why?)



model.matrix and makeContrasts in R

Aucun commentaire:

Enregistrer un commentaire