(p_values: Iterable, dependent=False, m=None, ordered=False)
return fdrs if not is_list else list(fdrs)
`False Discovery Rate <http://en.wikipedia.org/wiki/False_discovery_rate>`_
        correction on a list of p-values.

    :param p_values: list or np.ndarray of p-values.
    :param dependent: use correction for dependent hypotheses (default False).
    :param m: number of hypotheses tested (default ``len(p_values)``).
    :param ordered: prevent sorting of p-values if they are already sorted
        (default False).
    :return: list or np.ndarray, same as the input
`False Discovery Rate <http://en.wikipedia.org/wiki/False_discovery_rate>`_
        correction on a list of p-values.
False Discovery Rate <http : // en . wikipedia . org / wiki / False_discovery_rate > _ correction on a list of p - values .
def FDR(p_values: Iterable, dependent=False, m=None, ordered=False) -> Iterable:
    """ `False Discovery Rate <http://en.wikipedia.org/wiki/False_discovery_rate>`_
        correction on a list of p-values.

    :param p_values: list or np.ndarray of p-values.
    :param dependent: use correction for dependent hypotheses (default False).
    :param m: number of hypotheses tested (default ``len(p_values)``).
    :param ordered: prevent sorting of p-values if they are already sorted
        (default False).
    :return: list or np.ndarray, same as the input
    """
    if p_values is None or len(p_values) == 0 or \
            (m is not None and m <= 0):
        return None

    is_list = isinstance(p_values, list)
    p_values = np.array(p_values)
    if m is None:
        m = len(p_values)
    if not ordered:
        ordered = (np.diff(p_values) >= 0).all()
        if not ordered:
            indices = np.argsort(p_values)
            p_values = p_values[indices]

    if dependent:  # correct q for dependent tests
        m *= sum(1 / np.arange(1, m + 1))

    fdrs = (p_values * m / np.arange(1, len(p_values) + 1))[::-1]
    fdrs = np.array(np.minimum.accumulate(fdrs)[::-1])
    if not ordered:
        fdrs[indices] = fdrs.copy()
    return fdrs if not is_list else list(fdrs)
def FDR ( p_values : Iterable , dependent = False , m = None , ordered = False ) -> Iterable : if p_values is None or len ( p_values ) == 0 or ( m is not None and m <= 0 ) : return None is_list = isinstance ( p_values , list ) p_values = np . array ( p_values ) if m is None : m = len ( p_values ) if not ordered : ordered = ( np . diff ( p_values ) >= 0 ) . all ( ) if not ordered : indices = np . argsort ( p_values ) p_values = p_values [ indices ] if dependent : # correct q for dependent tests m *= sum ( 1 / np . arange ( 1 , m + 1 ) ) fdrs = ( p_values * m / np . arange ( 1 , len ( p_values ) + 1 ) ) [ : : - 1 ] fdrs = np . array ( np . minimum . accumulate ( fdrs ) [ : : - 1 ] ) if not ordered : fdrs [ indices ] = fdrs . copy ( ) return fdrs if not is_list else list ( fdrs )