class_docstr: Test multicomp.py.
docstr: Test function fdr.
  Compare to the p.adjust R function.
code: def test_fdr(self):
      """Test function fdr.
      Compare to the p.adjust R function.
      """
      # FDR BH
      # ------
      reject, pval_corr = fdr(pvals)
      assert_array_equal(reject, [False, False, True, False, False])
      assert_array_almost_equal(
          pval_corr, [0.52, 0.175, 0.0005, 0.075, 0.175]
      )
  
      # With NaN values
      _, pval_corr = fdr(pvals2_NA)
      assert_array_almost_equal(
          pval_corr, [0.52, np.nan, 0.28, 0.40, 0.28]
      )
  
      # With 2D arrays
      _, pval_corr = fdr(pvals_2d)
      pval_corr = np.round(pval_corr.ravel(), 3)
      assert_array_almost_equal(
          pval_corr,
          [
              0.52,
              0.21,
              0.001,
              0.135,
              0.21,
              0.52,
              np.nan,
              0.21,
              0.386,
              0.21,
          ],
      )
  
      # FDR BY
      # ------
      reject, pval_corr = fdr(pvals, method="fdr_by")
      assert_array_equal(reject, [False, False, True, False, False])
      assert_array_almost_equal(
          pval_corr,
          [1.0, 0.399583333, 0.001141667, 0.171250000, 0.399583333],
      )
  
      # With NaN values
      _, pval_corr = fdr(pvals2_NA, method="fdr_by")
      assert_array_almost_equal(
          pval_corr, [1.0, np.nan, 0.5833333, 0.8333333, 0.5833333]
      )
  
      # With 2D arrays
      _, pval_corr = fdr(pvals_2d, method="fdr_by")
      pval_corr = np.round(pval_corr.ravel(), 3)
      assert_array_almost_equal(
          pval_corr,
          [
              1.0,
              0.594,
              0.003,
              0.382,
              0.594,
              1.0,
              np.nan,
              0.594,
              1.0,
              0.594,
          ],
      )
  
file_path: pingouin/pingouin/tests/test_multicomp.py
imports: import pytest
  import numpy
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from unittest import TestCase
  from pingouin.multicomp import fdr, bonf, holm, sidak, multicomp
label_desc: Use image node_id 1 for calling the TestMulticomp obj's underlying member method code with example usage: obj.test_fdr() without return types