Search
Question: limma: bug in fitFDist()
0
gravatar for Rifius
8 days ago by
Rifius0
Rifius0 wrote:

Hi,

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

fitFDist(x, df1, covariate=NULL)

where

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 !

--c

 

ADD COMMENTlink modified 7 days ago by Gordon Smyth29k • written 8 days ago by Rifius0

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

ADD REPLYlink written 8 days ago by Gordon Smyth29k
1
gravatar for Aaron Lun
8 days ago by
Aaron Lun13k
Cambridge, United Kingdom
Aaron Lun13k 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 8 days ago by Aaron Lun13k

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 7 days ago • written 7 days ago by Gordon Smyth29k
Please log in to add an answer.

Help
Access

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