Class Cpw
java.lang.Object
edu.cmu.tetrad.algcomparison.algorithm.AbstractBootstrapAlgorithm
edu.cmu.tetrad.algcomparison.algorithm.oracle.pag.Cpw
- All Implemented Interfaces:
Algorithm, LatentStructureAlgorithm, ReturnsBootstrapGraphs, TakesCovarianceMatrix, HasParameters, TakesIndependenceWrapper, TetradSerializable, Serializable
@Algorithm(name="CPW",
command="cpw",
algoType=forbid_latent_common_causes,
dataType=Continuous)
@Bootstrapping
@Experimental
public class Cpw
extends AbstractBootstrapAlgorithm
implements Algorithm, TakesIndependenceWrapper, ReturnsBootstrapGraphs, TakesCovarianceMatrix, LatentStructureAlgorithm
Implements the CPW (Cyclic Pairwise) algorithm for causal discovery from
continuous, causally sufficient observational data. CPW combines FCI with
a pairwise left-right orientation rule to resolve edge directions that FCI
leaves ambiguous, under the assumption of no latent common causes and no
selection bias. Acyclicity is not assumed: the FCI output is read as a
PAG in the sigma-separation sense (valid for cyclic linear models; cf.
Mooij & Claassen, 2020), and the pairwise orientation phase may
produce cycles in the final graph.
The algorithm runs in one pass:
- Pairwise forbidden knowledge construction. For every pair of variables (X, Y), a pairwise left-right statistic is computed on standardized data. If the statistic favors X → Y, the reverse edge Y → X is added to a forbidden knowledge object, which is passed to FCI. Note that these forbids do constrain the search beyond orientation: FCI's adjacency phase excludes a variable forbidden as a cause of X from X's separating-set candidates, so the skeleton itself is steered by the pairwise statistic (empirically a net benefit on skewed linear data; dropping the knowledge costs accuracy on every structure tested).
- FCI search. FCI is run with the pairwise forbidden knowledge, producing a PAG. The collider orientation strategy (SEPSETS, CONSERVATIVE, or MAX_P) and other FCI parameters are configurable. Optionally an FDR correction loop is applied to the independence tests.
- Two-cycle detection. When the two-cycle alpha is positive,
each adjacent pair (other than a bidirected one) is first given
FASK's two-cycle test, conditioning on the pair's adjacents in the
PAG; a pair that passes is output as a 2-cycle (X → Y and Y → X)
and is exempt from the pairwise orientation below. This is what
lets CPW represent the smallest cycles at all: the pairwise rule
by itself always commits to a single direction. The test is run
with
Fask.TwoCycleRule.SLOPE_SHIFTrather than FASK's published correlation comparison, which has no asymptotic level on acyclic data outside strongly right-skewed noise and so injected false 2-cycles at a rate that grew with sample size. SeeFask.TwoCycleRulefor the reasoning andCpwLingamStudyfor the measurements. - Pairwise edge orientation. Edges left ambiguous by FCI are
further oriented using the pairwise left-right rule on standardized
data, subject to the following case analysis:
- Tail–tail (—): oriented fully as X → Y or Y → X per the pairwise statistic.
- Tail–circle (—o) or circle–tail (o—): the circle end is resolved to a tail or arrow if the pairwise statistic provides clear evidence.
- Circle–circle (o–o): one circle end is converted to an arrow in the preferred direction.
- Circle–arrow (o→) or arrow–circle (←o): under causal sufficiency, the circle is resolved to a tail.
The pairwise left-right rule is selected via the PAIRWISE_RULE
parameter (1=FASK1, 2=FASK2, 3=RSKEW, 4=SKEW, 5=TANH; default 2).
Time-lagged data is supported via the TIME_LAG parameter, which
prepends lag columns before search.
This algorithm is marked Experimental and is intended for
linear, non-Gaussian, causally sufficient data.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCpw()Default constructor for the Cpw class.Cpw(IndependenceWrapper test) Constructor for the Cpw class that initializes the algorithm with a specified independence test wrapper. -
Method Summary
Modifier and TypeMethodDescriptiongetComparisonGraph(Graph graph) Generates a comparison graph for the given graph by transforming it into a partial ancestral graph (PAG) representation viadagToPag.Retrieves the data type associated with the current instance of the algorithm.Provides a textual description of the CPW algorithm, including its functionality and distinguishing features, such as the use of pairwise-derived forbidden knowledge and pairwise orientation for certain edges.Retrieves the current instance of theIndependenceWrapperused for conditional independence testing in the algorithm.Retrieves a list of parameter names required for the configuration of the CPW algorithm.runSearch(DataModel dataModel, Parameters parameters) Executes the search algorithm on a given data model and set of parameters, producing a partial ancestral graph (PAG) that represents the causal structure inferred from the data.voidSets theIndependenceWrapperinstance used for conditional independence testing in the algorithm.Methods inherited from class AbstractBootstrapAlgorithm
getBootstrapGraphs, searchMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ReturnsBootstrapGraphs
getBootstrapGraphs
-
Constructor Details
-
Cpw
public Cpw()Default constructor for the Cpw class. This constructor initializes the instance without any specific parameters or configurations. It is typically used for -
Cpw
Constructor for the Cpw class that initializes the algorithm with a specified independence test wrapper.- Parameters:
test- The IndependenceWrapper instance used for conditional independence testing.
-
-
Method Details
-
runSearch
Executes the search algorithm on a given data model and set of parameters, producing a partial ancestral graph (PAG) that represents the causal structure inferred from the data. The output graph may contain cycles.The underlying functionality includes handling time-lagged data, standardizing, generating internal knowledge, performing conditional independence tests, and refining the graph using pairwise adjustments based on standardization and rules.
- Parameters:
dataModel- The data model to analyze, typically aDataSet, which contains the data from which causal relationships are inferred. Must be continuous for proper functioning.parameters- Algorithm parameter settings that control various aspects of the computation, such as time lagging, collider orientation style, pairwise rules, and limits on graph structure exploration.- Returns:
- A
Graphrepresenting the causal structure inferred by the search algorithm, encoded as a PAG. - Throws:
InterruptedException- If the search process is interrupted during execution, possibly due to thread interruption.
-
getComparisonGraph
Generates a comparison graph for the given graph by transforming it into a partial ancestral graph (PAG) representation viadagToPag.Note that this transform assumes an acyclic true graph, so algcomparison runs against cyclic ground truth are not supported through this path.
- Specified by:
getComparisonGraphin interfaceAlgorithm- Parameters:
graph- The inputGraphto be transformed into a comparison graph. This graph serves as the basis for creating the resulting PAG.- Returns:
- A
Graphrepresenting the transformed partial ancestral graph (PAG) based on the input graph.
-
getDescription
Provides a textual description of the CPW algorithm, including its functionality and distinguishing features, such as the use of pairwise-derived forbidden knowledge and pairwise orientation for certain edges.- Specified by:
getDescriptionin interfaceAlgorithm- Returns:
- A string describing the CPW algorithm and its characteristics.
-
getDataType
Retrieves the data type associated with the current instance of the algorithm. The data type defines whether the dataset is continuous, discrete, mixed, or another recognized type.- Specified by:
getDataTypein interfaceAlgorithm- Returns:
- The
DataTyperepresenting the type of dataset required or handled by the algorithm.
-
getParameters
Retrieves a list of parameter names required for the configuration of the CPW algorithm. These parameters control various aspects of the algorithm's execution, such as graph exploration limits, orientation styles, and additional settings affecting the causal inference process.- Specified by:
getParametersin interfaceHasParameters- Returns:
- A list of strings, where each string represents a parameter name used by the CPW algorithm.
-
getIndependenceWrapper
Retrieves the current instance of theIndependenceWrapperused for conditional independence testing in the algorithm.- Specified by:
getIndependenceWrapperin interfaceTakesIndependenceWrapper- Returns:
- The
IndependenceWrapperinstance being used by this algorithm.
-
setIndependenceWrapper
Sets theIndependenceWrapperinstance used for conditional independence testing in the algorithm.- Specified by:
setIndependenceWrapperin interfaceTakesIndependenceWrapper- Parameters:
test- The IndependenceWrapper instance to be used for testing conditional independence relations.
-