Test of Multiple Linear Combination on coefficients from Wald Test in Deseq2
1
0
Entering edit mode
@6fb6fae8
Last seen 28 days ago
Taiwan

Hello everyone, I am a beginner with the DESeq2 package, and I am trying to understand the mathematical principles behind this package.

In statistical modeling and hypothesis testing, a contrast vector c is used to construct specific linear combinations in order to test whether this linear combination equals a certain hypothesized value. A example below.

If I have a condition with four group, to avoid dummy trap & not full rank of matrix, a regression equation must like : Y = Beta_0 + Beta_1 X_1 + Beta_2 X_2 + Beta_3 * X_3 + error. Where "Y" is read counts and "Beta_1 to Beta_3" is dummy variables.

Question1: When I have a factor that has been incorporated into the intercept, and I want to compare Beta_1 with the factor that has been incorporated into the intercept, how should I set the contrast vector? Which one of the contrast vector ( [1,-1,0,0] or [0,1,0,0] ) is correct?

Question2: Log2foldChange represents the logarithmic expression difference between two groups. When the contrast vector multiply Beta vector = q. Is set to q = 0, doesn't taking the logarithm result in infinity? How does the software avoid the occurrence of infinite values?

Regression DESeq2 • 234 views
0
Entering edit mode
@james-w-macdonald-5106
Last seen 4 hours ago
United States

If your coefficients are the contrasts you want, you can just use the name argument. Or you can specify the contrast using the column and levels from your colData, or you can specify the contrast using your second option. Or if the coefficient you care about is the last one, you can just use the defaults.

>  dds <- makeExampleDESeqDataSet(m=4)
>  dds <- DESeq(dds)
estimating size factors
estimating dispersions
gene-wise dispersion estimates
mean-dispersion relationship
final dispersion estimates
fitting model and testing
> first <- results(dds, name = "condition_B_vs_A")
> second <- results(dds)
> third <- results(dds, c("condition","B","A"))
> fourth <- results(dds, c(0,1))
> all.equal(first, second)
[1] TRUE
> all.equal(first, third)
[1] TRUE
> all.equal(first, fourth, check.attributes = FALSE)
[1] TRUE

0
Entering edit mode

Oh, and I don't understand your second question. If you set a contrast vector to be all zeros (which I think is what you are asking), then you are telling DESeq2 that you don't want any comparison and it tells you that is not a thing.

> results(dds, c(0,0))
Error in checkContrast(contrast, resNames) :
numeric contrast vector cannot have all elements equal to 0