Residualizes X and Y on the conditioning variables with linear
regression (pgmpy's Pillai default is a random forest) and computes the
Pillai trace from the exact canonical correlations of the residuals.
Conditioning variables are one-hot encoded minus one level. A categorical
X or Y becomes K - 1 level indicators, residualized with a linear
probability model. Factor and numeric columns may be mixed. Degenerate
inputs raise errors instead of returning NaN. Conditioning sets whose
columns are linearly dependent (duplicate or nested categorical variables, a
constant column)
raise a degenerate-data error, whereas pgmpy fits them by least squares.
When Z is not empty and n - columns == max(p, q), the residuals force
V = s and the test returns p = 0 ("dependent"), as pgmpy does. When
n - columns < max(p, q), the test raises an error.
pillai(data)A dataset() result or a data.frame.
A fastcit_test bound to data.