Class ScoreIndTest
- All Implemented Interfaces:
IndependenceTest
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Constructor Summary
ConstructorsConstructorDescriptionScoreIndTest(Score score) Constructor for ScoreIndTest.ScoreIndTest(Score score, DataModel data) Constructor for ScoreIndTest. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true just in case calibrated p-value reporting has been requested AND the wrapped score can supply it in its current configuration.checkIndependence(Node x, Node y, Set<Node> z) Checks the independence between two nodes given a set of additional nodes.booleandetermines(List<Node> z, Node y) Determines the result of an independence test between a set of variables and a target variable.doublegetAlpha()Returns the significance level of the independence test.getCov()Returns the covariance matrix.getData()Retrieves the data model associated with this object.Returns the datasets for this testDeclares what this test can do, natively, with data containing missing values.intReturns the sample size.getVariable(String name) Retrieves the Node object with the specified name.Returns the list of variables over which this independence checker is capable of determinining independence relations.Returns the score object that this test wraps.indTestSubset(List<Node> vars) Tests the independence between variables in a given sublist.booleanReturns false: the value this test reports in the p-value slot is a score difference (negative for independence, positive for dependence), not a probability, so SMALLER values mean stronger evidence of independence.booleanReturns a boolean indicating whether verbose output is enabled.voidsetAlpha(double alpha) Sets the significance level for the independence test.voidsetCalibratePValues(boolean calibratePValues) Sets whether this test reports a calibrated p-value in the p-value slot of its results, in place of the raw local score difference.voidsetVerbose(boolean verbose) Sets whether verbose output is enabled or not.toString()Returns a string representation of the object.Methods inherited from interface IndependenceTest
canBeSubsampled, checkIndependence, determines, getVariableNames
-
Constructor Details
-
ScoreIndTest
-
ScoreIndTest
-
-
Method Details
-
indTestSubset
Tests the independence between variables in a given sublist.- Specified by:
indTestSubsetin interfaceIndependenceTest- Parameters:
vars- The sublist of variables to test independence.- Returns:
- The result of the independence test.
-
checkIndependence
public IndependenceResult checkIndependence(Node x, Node y, Set<Node> z) throws InterruptedException Checks the independence between two nodes given a set of additional nodes.- Specified by:
checkIndependencein interfaceIndependenceTest- Parameters:
x- The first nodey- The second nodez- The set of additional nodes- Returns:
- The result of the independence test
- Throws:
InterruptedException- If the process is interrupted during the execution.
-
getVariables
Returns the list of variables over which this independence checker is capable of determinining independence relations.- Specified by:
getVariablesin interfaceIndependenceTest- Returns:
- This list.
-
getVariable
Retrieves the Node object with the specified name.- Specified by:
getVariablein interfaceIndependenceTest- Parameters:
name- The name of the Node object to retrieve.- Returns:
- The Node object with the specified name, or null if not found.
-
determines
-
isPValueAProbability
public boolean isPValueAProbability()Returns false: the value this test reports in the p-value slot is a score difference (negative for independence, positive for dependence), not a probability, so SMALLER values mean stronger evidence of independence. Callers ranking sepsets by strength must reverse their comparison accordingly.- Specified by:
isPValueAProbabilityin interfaceIndependenceTest- Returns:
- False, always.
-
calibrationActive
public boolean calibrationActive()Returns true just in case calibrated p-value reporting has been requested AND the wrapped score can supply it in its current configuration.- Returns:
- True if calibrated p-values are being reported.
-
setCalibratePValues
public void setCalibratePValues(boolean calibratePValues) Sets whether this test reports a calibrated p-value in the p-value slot of its results, in place of the raw local score difference. Off by default.The accept/reject decision is NOT affected: independence is judged by the sign of the local score difference either way, so a search run with this on returns the same graph. What changes is what the test REPORTS: with calibration on,
IndependenceResult.getPValue()is a probability that is asymptotically Uniform(0, 1) under the null,getAlpha()is the level at which the score's sign rule operates, andisPValueAProbability()is true -- which together make the p-value-distribution diagnostics of the Markov check (Anderson-Darling, KS, Fisher, binomial) well defined for a score-based test. The raw score difference remains available fromIndependenceResult.getScore().Requesting this when the wrapped score cannot supply it (it does not implement
ProvidesCalibratedPValue, or does but is configured with a non-zero structure prior) is a no-op:calibrationActive()stays false and the test behaves exactly as before.- Parameters:
calibratePValues- Whether to report calibrated p-values.
-
getAlpha
public double getAlpha()Returns the significance level of the independence test.- Specified by:
getAlphain interfaceIndependenceTest- Returns:
- This level.
- Throws:
UnsupportedOperationException- if there is no significance level.
-
setAlpha
public void setAlpha(double alpha) Sets the significance level for the independence test.- Specified by:
setAlphain interfaceIndependenceTest- Parameters:
alpha- The level of significance to be set.
-
getData
Retrieves the data model associated with this object.- Specified by:
getDatain interfaceIndependenceTest- Returns:
- The data model object.
-
getCov
Returns the covariance matrix.- Specified by:
getCovin interfaceIndependenceTest- Returns:
- This matrix.
-
getDataSets
Description copied from interface:IndependenceTestReturns the datasets for this test- Specified by:
getDataSetsin interfaceIndependenceTest- Returns:
- these datasets.
- Throws:
UnsupportedOperationException- since not implemented.
-
getSampleSize
public int getSampleSize()Returns the sample size.- Specified by:
getSampleSizein interfaceIndependenceTest- Returns:
- This size.
-
getWrappedScore
Returns the score object that this test wraps.- Returns:
- This score object.
- See Also:
-
isVerbose
public boolean isVerbose()Returns a boolean indicating whether verbose output is enabled.- Specified by:
isVerbosein interfaceIndependenceTest- Returns:
- true if verbose output is enabled, false otherwise
-
setVerbose
public void setVerbose(boolean verbose) Sets whether verbose output is enabled or not.- Specified by:
setVerbosein interfaceIndependenceTest- Parameters:
verbose- true if verbose output is enabled, false otherwise
-
toString
Returns a string representation of the object.- Specified by:
toStringin interfaceIndependenceTest- Overrides:
toStringin classObject- Returns:
- A string representing the object.
-
getMissingValueSupport
Declares what this test can do, natively, with data containing missing values. The default isMissingValueSupport.NONE, meaning that missingness must be handled upstream (e.g., by imputation, or by supplying an EM-estimated covariance matrix if the test consumes one); tests that handle missing values themselves should override this.Delegates to the wrapped score: this test has exactly the missing-data support of its score.
- Specified by:
getMissingValueSupportin interfaceIndependenceTest- Returns:
- This support level.
-