Package edu.cmu.tetrad.search.utils
Class EnsureMarkov
java.lang.Object
edu.cmu.tetrad.search.utils.EnsureMarkov
A helper class to encapsulate logic for ensuring a Markov property for subsequent testing after an initial local
Markov graph has been found.
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEnsureMarkov
(Graph dag, IndependenceTest test) Constructs an EnsureMarkov class for a given Markov dag. -
Method Summary
Modifier and TypeMethodDescriptionlocalMarkovAdjustPValues
(Graph cpdag, boolean ensureMarkov, 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
markovIndependence
(Node x, Node y, Set<Node> z) 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.void
setEnsureMarkov
(boolean ensureMarkov) Sets whether to ensure Markov property.
-
Constructor Details
-
EnsureMarkov
Constructs an EnsureMarkov class for a given Markov dag.- Parameters:
dag
- The initial Markov dag. This dag should pass a local Markov check.test
- The independence test to use.
-
-
Method Details
-
localMarkovAdjustPValues
public static Map<org.apache.commons.lang3.tuple.Pair<Node,Node>, localMarkovAdjustPValuesSet<Double>> (Graph cpdag, boolean ensureMarkov, IndependenceTest test, Map<org.apache.commons.lang3.tuple.Pair<Node, Node>, throws InterruptedExceptionSet<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).- Parameters:
cpdag
- the constraint-based partially directed acyclic graph (CPDAG) to adjust p-values forensureMarkov
- a boolean flag indicating if the Markov condition should be ensured; should be truetest
- the independence test to be used; must not be null and not an instance of MsepTestpValues
- a map of node pairs to sets of p-values used for adjustmentwithoutPair
- 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 ensureMarkov is false or if the test is null or an instance of MsepTestInterruptedException
-
setEnsureMarkov
Sets whether to ensure Markov property. By default, false; this must be turned on.- Parameters:
ensureMarkov
- True if the Markov property should be ensured.- Throws:
InterruptedException
-
markovIndependence
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
-