lcdblib.stats package

Submodules

lcdblib.stats.fisher module

Module for easily running and reporting Fishers exact tests.

lcdblib.stats.fisher.fisher(table)[source]

Perform a Fisher’s exact test.

Parameters:table (list or tuple, length=4) – The four cells of a 2x2 table: [r1c1, r1c2, r2c1, r2c2]
Returns:
Return type:Tuple of (odds ratio, two-sided pvalue)
lcdblib.stats.fisher.fisher_tables(table, row_names=['class 1', 'not'], col_names=['class 2', 'not'], title=None)[source]

Print all tables along with the FET results

lcdblib.stats.fisher.print_2x2_table(table, row_labels=['class 1', 'not'], col_labels=['class 2', 'not'], fmt='%d')[source]

Prints a table used for Fisher’s exact test. Adds row, column, and grand totals.

Parameters:
  • table (list or tuple, length=4) – The four cells of a 2x2 table: [r1c1, r1c2, r2c1, r2c2]
  • row_labels (list) – A length-2 list of row names
  • col_labels (list) – A length-2 list of column names
lcdblib.stats.fisher.print_col_perc_table(table, row_labels=['class 1', 'not'], col_labels=['class 2', 'not'])[source]

Returns a string form of the table showing column percentages.

Parameters:
  • table (list or tuple, length=4) – The four cells of a 2x2 table: [r1c1, r1c2, r2c1, r2c2]
  • row_labels (list) – A length-2 list of row names
  • col_labels (list) – A length-2 list of column names
lcdblib.stats.fisher.print_row_perc_table(table, row_labels=['class 1', 'not'], col_labels=['class 2', 'not'])[source]

Returns a string form of the table showing row percentages.

Parameters:
  • table (list or tuple, length=4) – The four cells of a 2x2 table: [r1c1, r1c2, r2c1, r2c2]
  • row_labels (list) – A length-2 list of row names
  • col_labels (list) – A length-2 list of column names
lcdblib.stats.fisher.table_from_bool(ind1, ind2)[source]

Given two boolean arrays, return the 2x2 contingency table

ind1, ind2 : array-like
Arrays of the same length

Module contents