find_optimal_coef#
- MDDC.MDDC.find_optimal_coef(contin_table, rep=1000, target_fdr=0.05, grid=0.1, exclude_small_count=True, col_specific_cutoff=True, seed=None)#
Find Adaptive Boxplot Coefficient coef via Grid Search. The algorithm can be found at Algorithms
This function performs a grid search to determine the optimal adaptive boxplot coefficient coef for each column of a contingency table, ensuring that the target false discovery rate (FDR) is met.
Parameters:#
- contin_tablenumpy.ndarray
A matrix representing the I x J contingency table.
- repint, optional
The number of simulated tables under the assumption of independence between rows and columns. Default is 1000.
- target_fdrfloat, optional
The desired level of false discovery rate (FDR). Default is 0.05.
- gridfloat, optional
The size of the grid added to the default value of coef = 1.5 as suggested by Tukey. Default is 0.1.
- exclude_small_countbool, optional
Whether to exclude cells with counts smaller than or equal to five when computing boxplot statistics. Default is True.
- col_specific_cutoffbool, optional
If True, then a single value of the coefficient is returned for the entire dataset, else when False specific values corresponding to each of the columns are returned.
Returns:#
- OptimalCoefnamedtuple
A namedtuple with the following elements:
- ‘coef’: numpy.ndarray
A numeric array containing the optimal coefficient coef for each column of the input contingency table.
- ‘FDR’: numpy.ndarray
A numeric array with the corresponding false discovery rate (FDR) for each column.
Examples:#
>>> # Example using a simulated contingency table >>> import numpy as np >>> contin_table = np.random.randint(0, 100, size=(10, 5)) >>> find_optimal_coef(contin_table)