andrey.core.ci_missing.TestwiseDeletion#
- class andrey.core.ci_missing.TestwiseDeletion(data, build, *, name, test_class, continuous, check_copies)[source]#
A conditional-independence test that deletes rows per test on data with missing values.
Built by
make_indep_test()over data holdingNaN. A query ofxandygivenSkeeps the rows observed in every one of the columns{x, y} | S, builds the registered test over that block, its columns in data order, and returns that test’s p-value for the query. Queries are canonicalized asFisherZ’s are. The test of a block answers every later query over the same columns; the blocks the reused tests hold stay within_CACHE_BYTES, the least recently used dropped first. A nonlinear or a registered test, whose state grows with its queries, is built anew for each query. A partial-correlation test gets theGaussianDeletionsubclass, which builds no test per block.A query raises
ValueErrorwhen its block has fewer rows than its test needs: 2, or|S| + 3for"fisherz"and"student_t", the rows their degrees of freedom need; when a continuous column is constant on the block, as a constant column of the data is rejected before a fit; and when the test fails on the block or gives a p-value that is not a number, as a mixed-data test can on a block with fewer rows than columns. A categorical column with one category on the block is left to the test.- Parameters:
data (
ndarray) – Values withNaNmarking the missing ones; no infinities.build (
Callable[[ndarray,list[int]],CITest]) –build(block, columns)builds the registered test overblock, the kept rows ofcolumns.name (
str) – Theindep_testname, for the messages.test_class (
type|None) – The classbuildreturns,Nonefor a registered test. It decides which of the partial-correlation methods the wrapper offers, what it reuses, and its BLAS pinning.continuous (
ndarray|None) – Marks the continuous columns, which a block may not hold constant;Nonemarks none.check_copies (
bool) – RaiseCopiedColumnsErrorwhen a partial-correlation block holds columns that repeat others up to scale and shift, asmake_indep_test()does on complete data.
- statistic_pvalues(x, y, conditions)[source]#
Statistics and p-values of many queries, each from the test over its own rows.
xandyare(N,)int arrays andconditionsthe(N, m)int array of conditioning sets; entryiis the block test’sstatistic_pvaluesof queryi. A block test without that method reports only p-values: its statistic isp_value_statistic()of the p-value.