Class TwoIndicatorTest
Setting. X1 and X2 share a factor L with reference variables R1..Rm (m at least 2), whose only connection to X1 and X2 is through L and which share no other source among themselves. Errors are independent; the model is linear.
The part of the third cumulant k(Xi, Xj, Xk), i, j, k in {1, 2}, due to L is k(Xi, Ra, Rb) cov(Xj, Ra) cov(Xk, Rb) / cov(Ra, Rb)^2 for any two distinct references (averaged here over the ordered pairs). Subtracting it leaves residual cumulants R_ijk involving only the sources X1 and X2 share beyond L and their own errors. If X1 --> X2, X1's only source beyond L is the one it passes to X2, so T12 = R111 R122 - R112^2 = 0; if X2 --> X1, T21 = R222 R112 - R122^2 = 0; if a further latent (or correlated errors) is shared, both are nonzero provided the variables' own errors are skewed. Each is put on the scale n = T / (|first product| + second term squared), which lies in [-1, 1] and is unchanged by rescaling any variable.
The decision is conservative: an edge has to be shown, not merely not refuted. X1 --> X2 is returned when the 90% percentile bootstrap interval for n12 lies inside (-delta, delta) (an equivalence test at 5%) and the 95% interval for n21 excludes 0; X2 --> X1 likewise with the roles swapped. LATENT is returned when both 95% intervals exclude 0 and neither n is shown equivalent to 0. Anything else is UNDECIDED, which is the only answer possible when the errors are Gaussian (every n is then 0 or a ratio of noise).
In simulation (linear, three clean references, N = 5000), with delta = 0.1 no latent was read as an edge, and about
half of the true edges were found; the rest came back undecided, or occasionally latent: n is a ratio of sample
cumulants and has a small bias under a true edge at N in the thousands (about -0.016 at N = 5000 in one design,
vanishing by N = 20000), which the percentile intervals carry. That errs toward keeping a latent. Basic
(bias-corrected) intervals recover some of those edges but behave erratically under Gaussian errors, so they are
not used. Weakly skewed or ceiling-truncated data, too few
rows, or references that are not pure indicators of the same factor will all degrade it; the last can make it
wrong rather than undecided. The simulation is impurity_cumulant_sim.py (kept outside the repository);
edu.cmu.tetrad.search.harness.RlcdTwoIndicatorStudy measures the step inside RLCD.
- Author:
- josephramsey
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe answer.static final recordThe result of the test. -
Method Summary
Modifier and TypeMethodDescriptionstatic TwoIndicatorTest.Resulttest(double[] x1, double[] x2, double[][] refs, double delta, int numBoot, long seed) Runs the test.
-
Method Details
-
test
public static TwoIndicatorTest.Result test(double[] x1, double[] x2, double[][] refs, double delta, int numBoot, long seed) Runs the test.- Parameters:
x1- the first variable's values.x2- the second variable's values.refs- the references' values, refs[r][row]; at least two.delta- the equivalence margin for n, in (0, 1).numBoot- the number of bootstrap resamples (a few hundred).seed- the bootstrap seed.- Returns:
- the result; UNDECIDED with NaN statistics if there are too few complete rows.
-