Skip to main content

fisher_exact_py

Function fisher_exact_py 

Source
pub fn fisher_exact_py(
    py: Python<'_>,
    table: &Bound<'_, PyArray2<f64>>,
    alternative: &str,
) -> PyResult<Py<PyAny>>
Expand description

Fisher’s exact test for 2x2 contingency tables.

Performs Fisher’s exact test on a 2x2 contingency table. This test is particularly useful for small sample sizes where the chi-square approximation may not be valid.

Parameters: table: 2x2 array of observed frequencies (must be 2x2) alternative: Alternative hypothesis (default: “two-sided”) - “two-sided”: Test if association exists - “less”: Test if odds ratio < 1 - “greater”: Test if odds ratio > 1

Returns: Dictionary with: - odds_ratio: Odds ratio (ad)/(bc) - pvalue: P-value for the test