Class EdgePriorTest
- All Implemented Interfaces:
IndependenceTest
IndependenceTest and gives each pair of variables its own significance level,
alpha_ij = w_ij * alpha, by testing the weighted p-value p_ij / w_ij against a common alpha.
The pair (x, y) is fixed across every conditioning set that could delete the adjacency, so w_xy is well defined for the whole sequence of tests on that pair, and the threshold does not depend on the order in which pairs or conditioning sets are visited. PC-Stable's order-independence is therefore preserved.
Direction of the effect. PC removes an edge when it fails to reject independence, that is when p > alpha. A larger threshold makes rejection easier and so protects the edge; a smaller one makes deletion easier. Hence w_xy > 1 shields an edge from deletion and w_xy < 1 accelerates it. Note which way round this is before choosing weights: if the failure mode being addressed is under-deletion, the useful weights are below one.
Two calibrations, both supported through EdgePriors. Either derive w_ij from
prior log-odds via EdgePriors.toWeightsViaBicBridge(double, int, double), which matches
the per-edge threshold that a prior-adjusted SEM BIC would use for the same edge and so puts
the score-based and constraint-based algorithms on one prior scale; or supply weights directly
and call EdgePriors.normalizedToMeanOne(), which is the Genovese-Roeder-Wasserman
formulation and carries an error-control guarantee for any fixed mean-one weights. The bridge
needs a trustworthy lambda log(n); the GRW route mentions no n at all. For summary-statistic
data, prefer GRW.
What the bridge does not do. The BIC bridge equates a per-decision threshold. It does not equate procedures. PC deletes an edge on finding any separating set, which at conditioning depth 3 over a hundred nodes is a minimum taken over on the order of 10^5 tests, whereas a score-based search makes one global choice of parent set. At matched lambda, PC therefore deletes considerably more, and a comparison of tuned operating points across the two families has to carry that caveat.
- Author:
- josephramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEdgePriorTest(IndependenceTest test, EdgePriors priors, double alpha) Constructs a prior-adjusted test. -
Method Summary
Modifier and TypeMethodDescriptioncheckIndependence(Node x, Node y, Set<Node> z) Checks the independence of x and y given z, judging the weighted p-value against the base alpha.booleandetermines(Set<Node> z, Node y) Returns true if y is determined by z, per the wrapped test.doublegetAlpha()Returns the base significance level, before per-edge weighting.doubleReturns the effective significance level for the unordered pair {x, y}, namely w_xy * alpha, capped at 1.getCov()Returns the covariance matrix of the wrapped test.getData()Returns the data model of the test.Returns the datasets of the wrapped test.intReturns the sample size of the wrapped test.Returns the variables of the test.Returns the wrapped test.booleanReturns true if this test prints verbose output.voidsetAlpha(double alpha) Not supported.voidsetVerbose(boolean verbose) Sets whether this test prints verbose output.toString()Returns a string representation of this test.doubleReturns the weight for the unordered pair {x, y}.Methods inherited from interface IndependenceTest
canBeSubsampled, checkIndependence, getMissingValueSupport, getVariable, getVariableNames, indTestSubset, isPValueAProbability
-
Constructor Details
-
EdgePriorTest
Constructs a prior-adjusted test.- Parameters:
test- The test to wrap; typically anIndTestFisherZ.priors- P-value weights, keyed by variable name. Resolved againsttest.getVariables()here, once, so the caller's matrix ordering is irrelevant. Build this once per locus and share it across subsample repeats: the GRW guarantee requires the weights to be fixed across the family of tests, so they must not be rebuilt or renormalised per repeat.alpha- The base significance level. Each pair is judged against w_xy * alpha.- Throws:
IllegalStateException- Ifpriorsdoes not hold weights.IllegalArgumentException- Ifpriorsmentions variables the test does not have, or alpha is out of range.
-
-
Method Details
-
checkIndependence
public IndependenceResult checkIndependence(Node x, Node y, Set<Node> z) throws InterruptedException Checks the independence of x and y given z, judging the weighted p-value against the base alpha.- Specified by:
checkIndependencein interfaceIndependenceTest- Parameters:
x- The first variable.y- The second variable.z- The conditioning set.- Returns:
- The result, carrying the weighted p-value.
- Throws:
InterruptedException- If the process is interrupted.
-
weight
-
getAlpha
-
getVariables
Returns the variables of the test.- Specified by:
getVariablesin interfaceIndependenceTest- Returns:
- This list.
-
getData
Returns the data model of the test.- Specified by:
getDatain interfaceIndependenceTest- Returns:
- This data model.
-
isVerbose
public boolean isVerbose()Returns true if this test prints verbose output.- Specified by:
isVerbosein interfaceIndependenceTest- Returns:
- True if so.
-
setVerbose
public void setVerbose(boolean verbose) Sets whether this test prints verbose output.- Specified by:
setVerbosein interfaceIndependenceTest- Parameters:
verbose- True if so.
-
getAlpha
public double getAlpha()Returns the base significance level, before per-edge weighting.- Specified by:
getAlphain interfaceIndependenceTest- Returns:
- This level.
-
setAlpha
public void setAlpha(double alpha) Not supported. The base alpha is fixed at construction, since the weights were calibrated against it; changing it afterwards would silently rescale every per-edge threshold.- Specified by:
setAlphain interfaceIndependenceTest- Parameters:
alpha- Ignored.
-
getCov
Returns the covariance matrix of the wrapped test.- Specified by:
getCovin interfaceIndependenceTest- Returns:
- This matrix.
-
getDataSets
Returns the datasets of the wrapped test.- Specified by:
getDataSetsin interfaceIndependenceTest- Returns:
- These datasets.
-
determines
Returns true if y is determined by z, per the wrapped test.- Specified by:
determinesin interfaceIndependenceTest- Parameters:
z- The conditioning set.y- The node.- Returns:
- True if so.
-
getSampleSize
public int getSampleSize()Returns the sample size of the wrapped test.- Specified by:
getSampleSizein interfaceIndependenceTest- Returns:
- This size.
-
getWrappedTest
-
toString
Returns a string representation of this test.- Specified by:
toStringin interfaceIndependenceTest- Overrides:
toStringin classObject- Returns:
- This string.
-