Class PreserveMarkov

java.lang.Object
edu.cmu.tetrad.search.utils.PreserveMarkov

public class PreserveMarkov extends Object
A helper class to encapsulate logic for preserving a Markov property for subsequent testing after an initial local Markov graph has been found.
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    PreserveMarkov(Graph graph, IndependenceTest test, boolean preserveMarkov)
    Constructs an PreserveMarkov class for a given Markov graph.
    Creates a new instance of the PreserveMarkov class by copying the fields from another PreserveMarkov object.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Map<org.apache.commons.lang3.tuple.Pair<Node,Node>,Set<Double>>
    markovAdjustPValues(Graph graph, boolean preserveMarkov, IndependenceTest test, Map<org.apache.commons.lang3.tuple.Pair<Node,Node>,Set<Double>> pValues, org.apache.commons.lang3.tuple.Pair<Node,Node> withoutPair)
    Adjusts the p-values for a local Markov condition in a given constraint-based partially directed acyclic graph (CPDAG).
    boolean
    Checks the independence of two nodes given a set of conditioning nodes, and if Markov is to be preserved, checks to make sure the additional independence does not generate p-values that violate the Markov property.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PreserveMarkov

      public PreserveMarkov(Graph graph, IndependenceTest test, boolean preserveMarkov)
      Constructs an PreserveMarkov class for a given Markov graph.
      Parameters:
      graph - The initial Markov graph. This graph should pass a local Markov check.
      test - The independence test to use.
      preserveMarkov - True if Markov should be preserved.
    • PreserveMarkov

      public PreserveMarkov(PreserveMarkov preserveMarkov)
      Creates a new instance of the PreserveMarkov class by copying the fields from another PreserveMarkov object.
      Parameters:
      preserveMarkov - The PreserveMarkov object to be copied. Must not be null.
  • Method Details

    • markovAdjustPValues

      public static Map<org.apache.commons.lang3.tuple.Pair<Node,Node>,Set<Double>> markovAdjustPValues(Graph graph, boolean preserveMarkov, IndependenceTest test, Map<org.apache.commons.lang3.tuple.Pair<Node,Node>,Set<Double>> pValues, org.apache.commons.lang3.tuple.Pair<Node,Node> withoutPair) throws InterruptedException
      Adjusts the p-values for a local Markov condition in a given constraint-based partially directed acyclic graph (CPDAG).
      Parameters:
      graph - the constraint-based partially directed acyclic graph (CPDAG) to adjust p-values for
      preserveMarkov - a boolean flag indicating if the Markov condition should be preserved; should be true
      test - the independence test to be used; must not be null and not an instance of MsepTest
      pValues - a map of node pairs to sets of p-values used for adjustment
      withoutPair - a pair of nodes for which adjustments are calculated without considering the edge between them
      Returns:
      a map of node pairs to sets of adjusted p-values
      Throws:
      IllegalArgumentException - if preserveMarkov is false or if the test is null or an instance of MsepTest
      InterruptedException - if any
    • markovIndependence

      public boolean markovIndependence(Node x, Node y, Set<Node> z) throws InterruptedException
      Checks the independence of two nodes given a set of conditioning nodes, and if Markov is to be preserved, checks to make sure the additional independence does not generate p-values that violate the Markov property. Returns the independence-result, marked as 'true' if the nodes are independent or if the Markov property is preserved and the nodes are independent and the Markov property wouldn't be violated by the additional independence.
      Parameters:
      x - The first node.
      y - The second node.
      z - The set of conditioning nodes.
      Returns:
      True if the nodes are independent.
      Throws:
      InterruptedException - if any.