NanoStringDiff contrast vectors
1
0
Entering edit mode
Paraskevi • 0
@bc2e00b0
Last seen 24 months ago
Canada

Hello,

I am a new user of the package NanoStringDiff. I am working on an experiment with 4 groups and I am trying to figure out how to design the contrast vector, specifically which numbers to use for each group. To the best of my understanding, "0" omits the group, and the numbers, "1,-1" are used in the examples of the package. Should I use "-1/2, 1/2" for the other 2 groups? Is there any chance that 1/2 takes the average of the corresponding group? In other words, how to decide which numbers to use for the contrast vector if we have more than 2 groups?

Thank you everyone

NanoStringDiff • 679 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 19 hours ago
United States

Assuming you have fit a cell means model (e.g., you used model.matrix(~ 0 + <group factor goes here>)), you should then use 0 for groups you don't want to compare, 1 for the first group and -1 for the second group in your comparison. To make your life easier, you should also use makeContrasts from the limma package.

> design <- model.matrix(~0 + gl(4, 3))
> colnames(design) <- LETTERS[1:4]
> contrast <- makeContrasts(A - B, B - C, C - D, levels = design)
> design
   A B C D
1  1 0 0 0
2  1 0 0 0
3  1 0 0 0
4  0 1 0 0
5  0 1 0 0
6  0 1 0 0
7  0 0 1 0
8  0 0 1 0
9  0 0 1 0
10 0 0 0 1
11 0 0 0 1
12 0 0 0 1
attr(,"assign")
[1] 1 1 1 1
attr(,"contrasts")
attr(,"contrasts")$`gl(4, 3)`
[1] "contr.treatment"

> contrast
      Contrasts
Levels A - B B - C C - D
     A     1     0     0
     B    -1     1     0
     C     0    -1     1
     D     0     0    -1

## A versus B

rslt <- glm.LRT(NanoStringData, design, contrast[,1])

## B versus C
rslt <- glm.LRT(NanoStringData, design, contrast[,2])

```

ADD COMMENT
0
Entering edit mode

I hit Enter too soon on my post, so you will need to come to the support site to see the whole thing.

ADD REPLY

Login before adding your answer.

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