Can one use t statistics from a Student's t-test directly in the fdrtool()
function of fdrtool
package (ver. 1.2.12)? The paper (Strimmer-K BMC Bioinfo. 2008, 9:303) mentions this but as far as I can see the parameters only recognize "normal", "correlation" and "pvalue". Is there a workaround for a non-statistician ?
R 'fdrtool' package: how to use t statistic
1k Views Asked by user3375672 At
2
There are 2 best solutions below
0

Turns out that the maintainer of the package, Korbinian Strimmer, disabled the t-score based function on purpose. The reason for that is that it has been used incorrectly too often.
Prof. Strimmer is a nice guy and responded to my help request quickly and very comprehensively. This is what he suggests: T-scores in practice often do not follow a t-distribution but show rather an over- or underdispersion, which is why you should better use the normal option.
Before that, however, you will have to center your data
z.centered = z-median(z)
fdrtool(z.centered, statistic="normal")
I think it's a typo.
I took a look at the source for the
fdrtool
function and found that thestatistic
argument first gets passed throughmatch.arg
and then tofdrtool:::get.nullmodel
.Then, lo and behold:
and indeed there is a fully-implemented case in that function for the student t:
Now, before I tell you how to access this option, I want to warn you that it's very possible it was disabled on purpose. I can't imagine why, because at first glance it seems like it should work fine. But if you're planning to use this in a research result you ought to document the fact that this was essentially a "hidden" option and that you had to do some hacking to access it. Moreover, I haven't actually tested this on my computer, so beware of typos.
Now, as for that hacking, the easiest way to get this to work would be to first simply type
fdrtool
into the R console. Then, copy and paste the output to a new R script (or usesink
if you're fancy like that). The first few lines should look like:Then all you have to do is change
c("normal", "correlation", "pvalue")
toc("normal", "correlation", "pvalue", "studentt")
. That is, the first few lines should now look likeFinally, reassign this function to
fdrtool
(don't worry, this won't break the underlying package, it will just act like a "mask" until you remove it withrm
):And run the whole thing or source the script. Then you should be good to go.