Class MarkovCheckNullReference

java.lang.Object
edu.cmu.tetrad.search.MarkovCheckNullReference

public final class MarkovCheckNullReference extends Object

Parametric-bootstrap null reference for the Markov check

A Markov check that fails under a strict independence test is ambiguous between two very different situations: (a) the test is miscalibrated at this sample size and data scale, so its p-values are non-uniform even when the implied independencies hold, and (b) the model is genuinely inadequate, i.e., the graph implies independencies the data violates. This class separates them experimentally: it fits a simulator to (data, DAG), simulates numDraws datasets that satisfy the DAG's factorization by construction, runs the identical Markov check on each, and reports where the real data's check statistic falls in that null distribution.

Simulators

Reading the result

MarkovCheckNullReference.Result.getEmpiricalP() is the fraction of null draws whose Anderson-Darling uniformity p-value (over independence facts) is at or below the real data's value; its resolution is 1/numDraws. Real fails while the GNM null passes: genuine graph/model inadequacy. GNM null also fails: test miscalibration under realistic conditionals, or simulator leakage -- compare with the linear null to separate those. Null values clustered near 1: a broken simulator (lost sampling variation), since under a healthy null the statistic should be roughly uniform. This class reports statistics only; decisions about the model belong to the user.

Caveats

  • The reference inherits the Markov check's one-sidedness: it certifies the implied independencies, not the dependencies missing edges fail to imply. It sharpens "fails Markov" into a diagnosis; it does not turn "passes Markov" into an endorsement.
  • With bootstrapped (unstratified) residuals for continuous children, parent-dependent noise scale in the real data may not be fully reproduced in the null draws, so part of a real-data failure may reflect variance structure rather than graph structure.
  • If the checked graph implies no independence facts, the Anderson-Darling statistics are undefined and the empirical p is reported as NaN.
  • For MarkovCheckNullReference.SimulatorType.LINEAR_SEM, draws use the shared RandomUtil stream; the base seed is applied to it once before the draws (a global side effect).
  • Method Details

    • compute

      public static MarkovCheckNullReference.Result compute(DataSet data, Graph graph, Function<DataSet, IndependenceTest> testFactory, ConditioningSetType conditioningSetType, MarkovCheckNullReference.SimulatorType simulator, int numDraws, int sampleSize, long baseSeed, TrainedDagSimulatorGNM.Params gnmParams)
      Computes the null reference using a test factory.
      Parameters:
      data - The observed dataset.
      graph - The graph whose Markov property is checked. A CPDAG is converted to a member DAG via GraphTransforms.dagFromCpdag(Graph); the DAG actually checked is available from the result.
      testFactory - Creates the Markov-check independence test for a given dataset; must produce the same test configuration used on the real data.
      conditioningSetType - The conditioning-set type for the Markov check.
      simulator - The null-draw simulator.
      numDraws - The number of null draws (empirical-p resolution is 1/numDraws).
      sampleSize - Rows per simulated dataset; nonpositive means the size of data.
      baseSeed - Base seed; draw b uses seed baseSeed + b (GNM), or the seed is applied once to RandomUtil (linear).
      gnmParams - Parameters for the GNM simulator; null means defaults. Ignored for the linear simulator.
      Returns:
      The MarkovCheckNullReference.Result.
    • compute

      public static MarkovCheckNullReference.Result compute(DataSet data, Graph graph, IndependenceWrapper testWrapper, Parameters parameters, ConditioningSetType conditioningSetType, MarkovCheckNullReference.SimulatorType simulator, int numDraws, int sampleSize, long baseSeed, TrainedDagSimulatorGNM.Params gnmParams)
      Convenience overload taking an IndependenceWrapper and Parameters, matching how the Markov-check test is configured in algcomparison and in py-tetrad's TetradSearch.
      Parameters:
      data - The observed dataset.
      graph - The graph whose Markov property is checked (see the primary overload for CPDAG handling).
      testWrapper - The independence-test wrapper for the Markov-check test.
      parameters - The parameters used to instantiate the test.
      conditioningSetType - The conditioning-set type for the Markov check.
      simulator - The null-draw simulator.
      numDraws - The number of null draws.
      sampleSize - Rows per simulated dataset; nonpositive means the size of data.
      baseSeed - Base seed for the draws.
      gnmParams - Parameters for the GNM simulator; null means defaults.
      Returns:
      The MarkovCheckNullReference.Result.