limma package - error code about F-statistics not found in fit
Entering edit mode
Last seen 13 months ago

Dear friends,

​I am a new limma user and keep getting an error code following the topTableF. I have not been able to find any information about the F-statistic not being found in the fit. Any suggestions? I am running Windows 10 and using R. 3.4.3.


> fit = lmFit((data), mod)
> fitContrasts <-,contrasts=contrast.matrix)
> eb <- eBayes(fitContrasts)
> results <- topTableF(eb, adjust="fdr",number=length(eb$coefficients))

Error in topTableF(eb, adjust = "fdr", number = length(eb$coefficients)) : 
  F-statistics not found in fit


> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] bindrcpp_0.2        limma_3.34.9        sva_3.26.0          BiocParallel_1.12.0 genefilter_1.60.0  
 [6] mgcv_1.8-23         nlme_3.1-131.1      forcats_0.3.0       stringr_1.3.0       dplyr_0.7.4        
[11] purrr_0.2.4         readr_1.1.1         tidyr_0.8.0         tibble_1.4.2        ggplot2_2.2.1      
[16] tidyverse_1.2.1    

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.16         lubridate_1.7.2      lattice_0.20-35      digest_0.6.15        assertthat_0.2.0    
 [6] psych_1.7.8          R6_2.2.2             cellranger_1.1.0     plyr_1.8.4           stats4_3.4.3        
[11] RSQLite_2.0          httr_1.3.1           pillar_1.2.1         rlang_0.2.0          lazyeval_0.2.1      
[16] readxl_1.0.0         rstudioapi_0.7       annotate_1.56.2      blob_1.1.0           S4Vectors_0.16.0    
[21] Matrix_1.2-12        splines_3.4.3        foreign_0.8-69       RCurl_1.95-4.10      bit_1.1-12          
[26] munsell_0.4.3        broom_0.4.3          compiler_3.4.3       modelr_0.1.1         pkgconfig_2.0.1     
[31] BiocGenerics_0.24.0  mnormt_1.5-5         matrixStats_0.53.1   IRanges_2.12.0       XML_3.98-1.10       
[36] crayon_1.3.4         bitops_1.0-6         grid_3.4.3           jsonlite_1.5         xtable_1.8-2        
[41] gtable_0.2.0         DBI_0.8              magrittr_1.5         scales_0.5.0         cli_1.0.0           
[46] stringi_1.1.7        reshape2_1.4.3       xml2_1.2.0           tools_3.4.3          bit64_0.9-7         
[51] Biobase_2.38.0       glue_1.2.0           hms_0.4.2            survival_2.41-3      parallel_3.4.3      
[56] yaml_2.1.18          AnnotationDbi_1.40.0 colorspace_1.3-2     rvest_0.3.2          memoise_1.1.0       
[61] bindr_0.1.1          haven_1.1.1  


limma • 799 views
Entering edit mode


I am going to  work on the design matrix as recommended.  Just to let you know however, that I did not get a message after lmFit(). 

I was able to run the lines to the results where I got another topTableF error:

> fit = lmFit((data), mod)
> fitContrasts <-,contrasts=contrast.matrix)
> eb <- eBayes(fitContrasts)
> results <- topTable(eb, n=Inf)

Error in topTableF(fit, number = number, genelist = genelist, adjust.method = adjust.method,  : 
  F-statistics not found in fit
Entering edit mode

That doesn't quite seem possible. If is.fullrank(mod) is FALSE, then you must get a message from lmFit() to tell you which coefficients are not estimable (i.e., which columns of the design matrix need to be dropped).

Entering edit mode
Aaron Lun ★ 27k
Last seen 15 hours ago
The city by the bay

eBayes doesn't report F-statistics if your design matrix is not of full rank. I daresay that running is.fullrank(mod) would give you FALSE. Remove linear dependencies in your design matrix and try again. In case you're wondering how to do that, here's a little illustrative example:

     Coef1 Coef2 Coef3
[1,]     1     0     1
[2,]     1     0     1
[3,]     1     1     0
[4,]     1     1     0

This matrix is not of full (column) rank, because Coef1 is simply the sum of Coef2 and Coef3. This means that it is impossible to obtain a unique solution for the coefficients, e.g., a solution of Coef1=0, Coef2=1 and Coef3=1 would give the same fitted values as Coef1=1, Coef2=0 and Coef3=0. You need to set up your design matrix to avoid these situations.

Entering edit mode

Thank you Aaron,  Running  is.fullrank(mod)  returned a FALSE.  Will work on my design matrix.

Entering edit mode
Last seen 2 hours ago
WEHI, Melbourne, Australia

Please don't use topTableF(). It's a low-level function intended for internal limma use rather than to be called directly by users. If you look at the example workflows, you will see that topTable() is always used, so just stick to that. The call

results <- topTable(eb, n=Inf)

is equivalent to your use of topTableF.

As Aaron has explained, we think that your design matrix is probably over-parametrized. If that is so, then you would have already got a message from lmFit() to alert you.


Login before adding your answer.

Traffic: 492 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6