Skip to content

multipletests - status and tests of 2step FDR procedures #766

Closed

Description

@josef-pkt

I just saw that R multtests includes also 2 step FDR procedures, but the references are different from the ones I implemented.

the FDR procedures where the fdr is estimated in a first step don't have unit tests. I didn't find reference implementation for it. (checked only in a coarse way against the articles)

Check at least with MonteCarlo tests and write regression tests

fdr_correction_twostep has in docstring

    Notes
    -----
    The returned corrected p-values, are from the last stage of the fdr_bh linear step-up
    procedure (fdrcorrection0 with method='indep')

However, for the reject decision, boolean, is based on different results then
pval_corrected <= alpha

-> check this, maybe we cannot just use the corrected p-values from the last stage, but that sounded correct to me from the paper AFAIR

edit:
The decision in the version before the current changes is not pval_corrected <= alpha but pval_corrected <= alpha_last_stage since we are correcting alpha in the 2-stage or iterative fdr correction.
For consistency with other pval correction methods, we should have pval_corrected <= alpha (although pval_corrected also depends on alpha in this cases). However, the pval_corrected of the last stage have fewer assumptions, since they only depend on the estimated number of null (?) cases, and not on alpha directly. (many alpha might have the same number of 1stage cases ntests0, but this is not assured for specific alphas, so still only partially useful)
-> maybe switch to returning a results instance so I can attach more info

summary Monte Carlo

alpha = 0.05 uniform = False
==============================================================================================
              b      s      sh     hs     h    hommel fdr_i  fdr_n  fdr_tsbky fdr_tsbh fdr_gbs
----------------------------------------------------------------------------------------------
reject      5.3224 5.3528 5.5694 5.6042 5.5656 5.6162 8.1974 5.8786   8.5892   8.6808   8.6296
pval        5.3224 5.3528 5.5694 5.6042 5.5656 5.6162 8.1974 5.8786   8.5892   8.6808   8.6296
r_any       0.9998  1.0   0.9998  1.0   0.9998  1.0    1.0   0.995     1.0      1.0     0.9998
p_any       0.9998  1.0   0.9998  1.0   0.9998  1.0    1.0   0.995     1.0      1.0     0.9998
r_>k         0.0    0.0   0.0008 0.001  0.0008 0.0008 0.0612 0.0018   0.115    0.1262   0.1232
p_>k         0.0    0.0   0.0008 0.001  0.0008 0.0008 0.0612 0.0018   0.115    0.1262   0.1232
r_>k excess  0.0    0.0   0.0008 0.001  0.0008 0.0008 0.0758 0.0018   0.1542   0.1726   0.1706
p_>k excess  0.0    0.0   0.0008 0.001  0.0008 0.0008 0.0758 0.0018   0.1542   0.1726   0.1706
fdrcr        0.0    0.0   0.0001 0.0001 0.0001 0.0001 0.0066 0.0002   0.0133   0.0148   0.0146
fdrcp        0.0    0.0   0.0001 0.0001 0.0001 0.0001 0.0066 0.0002   0.0133   0.0148   0.0146
----------------------------------------------------------------------------------------------

true number of cases where H0 is false is k=10, 5000 repetitions in MC
looking only at counts, not whether the correct pvalues get rejected
each statistic is once based on reject boolean and once checking the return pval_corr (no more discrepancies)

r_>k, p_>k : fraction of cases where more than k hypotheses are rejected, this can be large for some DGP (>40%)
(I had thought this is FDR, but it would be much too large, since all fdr methods control FDR at alpha)
fdrcr, fdrcp : mean proportion of "false" (or better more than k) hypothesis are rejected, close to definition of FDR ?

Activity

  1. josef-pkt commented on Apr 11, 2013

    @josef-pkt
    MemberAuthor

    related
    what's method='fdr_gbs' ?
    I thought there was a two stage or estimating fdr method that doesn't have pvals_corrected because it wasn't in the paper (?)

  2. josef-pkt commented on Apr 11, 2013

    @josef-pkt
    MemberAuthor

    fdr_correction_twostep pval_corrected don't take the correction to alpha into account
    in notes to fdr_correction, I mention that we can use a prior estimate to correct alpha (m/m0), but I didn't use it in
    fdr_correction_twostep to adjust the final pval_corrected

    Need to adjust notes in fdr_correction to mention that we need to use pvals_corrected <= alpha * (m/m0)

    with the m/m0 correction in fdr_correction_twostep, I get the same result as R multtest TSBH_0.05

    edit:
    there is something fishy, I get a test failure in 1 out of 33 cases with _twostage. I get now the same corrected pvalues as R, but my reject is different. Maybe there is a difference in the algorithm to the two references ?
    Checking Benjamini, Krieger, Yekutieli 2006 again: What I implemented is definition 6 as mentioned in the docstring, which is different from the Benjamini, Hochberg 2000 version.
    (So maybe I have BH for pvalues, and BKY for reject ? which differ in some cases ?)

    edit2:
    yes currently I have a bastard part 2s_bh, part 2s_bky. The original code was just bky.
    I think I will add an option to have both.

  3. jseabold commented on Apr 11, 2013

    @jseabold
    Member

    Cross-linking #357 since you are looking at this. Last time I was trying to use this, I wasn't sure what most beyond the usual corrections did.

  4. josef-pkt commented on Apr 11, 2013

    @josef-pkt
    MemberAuthor

    I will add some better docstrings.
    And it looks like there will only be one (currently undocumented) method left that I cannot verify against R multtest (they have every other method the same)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions