Expand description
Pillai’s-trace conditional-independence test (mixed discrete/continuous
data), after pgmpy’s PillaiTrace with linear residualization.
X and Y are linearly regressed on [1, Z] (a continuous variable gives one
residual column; a discrete variable with K levels gives K−1 columns, a
linear probability model). With residual blocks R_x (n × p) and R_y
(n × q), s = min(p, q), Pillai’s trace is
V = Σ ρᵢ² = tr(S_xx⁻¹ S_xy S_yy⁻¹ S_yx) over the canonical correlations,
computed exactly (no iterative CCA). The p-value uses pgmpy’s
F-approximation, df1 = p·q, df2 = s·(n − 1 + s − p − q),
F = (V/df1)·(df2/(s − V)), evaluated with the F survival function. The
effect size is V/s; the statistic is V.
As in pgmpy, df2 ignores the number of conditioning columns. When n
minus the number of design columns ([1, Z]) equals max(p, q) and Z is
not empty, the residuals force V = s and the test returns p = 0
(“dependent”), exactly as pgmpy does. When it is smaller than max(p, q),
a residual block is singular and the test returns an error. Linearly
dependent conditioning columns (duplicate or nested categoricals, a constant
column) raise a degenerate-data error, whereas pgmpy fits them by least
squares.
Structs§
- Pillai
- Pillai’s-trace test (linear residualization, mixed data).