API#

pywhy_stats:

This is the application programming interface (API) reference for classes (CamelCase names) and functions (underscore_case names) of pywhy-stats, grouped thematically by analysis stage.

Independence Testing#

Pyhy-Stats experimentally provides an interface for conditional independence testing and conditional discrepancy testing (also known as k-sample conditional independence testing).

High-level Independence Testing#

The easiest way to run a (conditional) independence test is to use the independence_test() function. This function takes inputs and will try to automatically pick the appropriate test based on the input.

Note: this is only meant for beginnners, and the result should be interpreted with caution as the ability to choose the optimal test is limited. When one uses the wrong test for the type of data and assumptions they have, then typically you will get less statistical power.

independence_test(X, Y[, condition_on, method])

Perform a (conditional) independence test to determine whether X and Y are independent.

Methods(value)

Methods for independence testing.

All independence tests return a PValueResult object, which contains the p-value and the test statistic and optionally additional information.

PValueResult(pvalue[, statistic, ...])

Data class representing the results of an hypothesis test that produces a p-value.

(Conditional) Independence Testing#

Testing for conditional independence among variables is a core part of many data analysis procedures.

fisherz

Independence test using Fisher-Z's test.

kci

Independence test using Kernel test.

power_divergence

Independence test among categorical variables using power-divergence tests.

(Conditional) K-Sample Testing#

Testing for invariances among conditional distributions is a core part of many data analysis procedures. Currently, we only support conditional 2-sample testing among two distributions.

bregman

Bregman (conditional) discrepancy test.

kcd

Kernel (conditional) discrepancy test.