[BioC] dealing with NAs in limma

Gordon Smyth smyth at wehi.EDU.AU
Thu Jun 14 01:31:55 CEST 2007


Dear Francois,

Yes, this is how it works. The function contrasts.fit() doesn't take 
special account of which contrast weights are zero, and zero*NA is still NA.

If you know that one of the coefficients doesn't appear in your 
contrast, you could remove it from the fit explicitly. So, instead of 
your fit2, you could use:

 > fit3 <- eBayes(contrasts.fit(fit[,-3],c(1,-1)))
 > fit3$coef
            [,1]
[1,]  0.3284042
[2,] -1.5506470
[3,] -0.4492955
[4,]  0.4414272
[5,] -0.2923152

Best wishes
Gordon

At 05:58 AM 14/06/2007, Francois Pepin wrote:
>Hi,
>
>I've got some 0-weight features on my arrays that are leading to NAs in
>limma where the log ratio cannot be estimated.
>
>Strangely to me, this also happens when I do differential expressions
>between arrays that do not have any NAs:
>
>mat<-matrix(c(rnorm(24),NA),5,5)
>#careful with line break here
>design<-matrix(c(-1,1,0,0,0,0,0,-1,1,0,0,0,0,0,1),5,3,dimnames=list
>(row=1:5,col=letters[1:3]))
>fit<-eBayes(lmFit(mat,design=design))
>fit2<-eBayes(contrasts.fit(fit,makeContrasts(a-b,levels=design)))
>
>#as expected, we have one NA in fit for the c sample
> > fit$coefficients
>               a         b          c
>[1,]  0.5935915 1.3025382 -0.1752245
>[2,]  0.6852898 0.3691623  0.8395249
>[3,]  0.4190820 1.3200322  0.6059554
>[4,] -0.5389328 1.5717505  0.4173681
>[5,] -0.1753151 0.7628686         NA
>
>#but also when we do a-b
> > fit2$coefficients
>       Contrasts
>             a - b
>   [1,] -0.7089467
>   [2,]  0.3161274
>   [3,] -0.9009502
>   [4,] -2.1106833
>   [5,]         NA
>
>Is this the expected behavior? Would there be any way to go around it?
>This means that any feature that has an NA in both samples of a dye swap
>will be uninformative for any other contrasts.
>
> > sessionInfo()
>R version 2.5.0 (2007-04-23)
>x86_64-unknown-linux-gnu
>
>locale:
>LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>
>attached base packages:
>[1] "stats"     "graphics"  "grDevices" "utils"  "datasets"
>[6] "methods"   "base"
>
>other attached packages:
>    limma
>"2.10.4"
>
>Francois



More information about the Bioconductor mailing list