Question: limma: bug in fitFDist()
gravatar for Rifius
4 months ago by
Rifius0 wrote:


limma function fitFDist() has a bug, triggered under rare circumstances.  As per the documentation:

fitFDist(x, df1, covariate=NULL)


df1: the first degrees of freedom of the F-distribution. Can be a single value, or else a vector of the same length as x.

In the case when df1 is a single value and one or more of the x values is not finite or below hard-coded limits, the function fails with:

Error in if (evar > 0) { : missing value where TRUE/FALSE needed

The reason is in this piece of fitFDist() code, at about line 22:

    ok <- is.finite(x) & is.finite(df1) & (x > -1e-15) & (df1 > 1e-15)
    notallok <- !all(ok)
    if (notallok) {
        x <- x[ok]
        df1 <- df1[ok]
        if (!is.null(covariate)) {
            covariate2 <- covariate[!ok]
            covariate <- covariate[ok]

The highlighted line will produce a list of NAs, which later on produces the error in line 74. A simple way to reproduce the error is to run the example in the vignette of package betr.

By the way, the length of df1 is not checked before use, and could fail in other places.

Line numbers are from stripped code.  Using:

R version 3.3.2 (2016-10-31)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora 25 (Workstation Edition)

[1] limma_3.30.7     betr_1.33.0

Thanks !



ADD COMMENTlink modified 4 months ago by Gordon Smyth30k • written 4 months ago by Rifius0

To avoid confusion, it might be worth noting that the betr package is no longer available from Bioconductor.

ADD REPLYlink written 4 months ago by Gordon Smyth30k
gravatar for Aaron Lun
4 months ago by
Aaron Lun14k
Cambridge, United Kingdom
Aaron Lun14k wrote:

Thanks for spotting this. An even simpler failing example would just be:

fitFDist(c(NA, 1), 1)

... which yields the same error as your original post. Funnily enough, we had spotted and fixed the same bug last year in the fitFDistRobustly function; I guess we never got around to fixing it for fitFDist itself.

ADD COMMENTlink written 4 months ago by Aaron Lun14k

I have just committed a fix to limma 3.30.8. This bug is never triggered in the limma linear model pipelines because df1 is always a vector, which explains why we've never noticed it.

ADD REPLYlink modified 4 months ago • written 4 months ago by Gordon Smyth30k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 225 users visited in the last hour