Package edu.cmu.tetrad.search.test
Class IndTestGin
java.lang.Object
edu.cmu.tetrad.search.test.IndTestGin
- All Implemented Interfaces:
IndependenceTest
GIN (Generalized Independent Noise) conditional independence test. Reduces CI X ⟂ Y | S to unconditional independence
of regression residuals:
- rX := X - E[X | S \ {X}]
- rY := Y - E[Y | S \ {Y}]
Then tests rX ⟂ rY using an unconditional backend (dCor by default).
Assumes continuous data. For mixed data, provide a different Regressor (e.g., RF).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDistance correlation (biased) with optional permutations.static final classRepresents a ridge-regularized ordinary least squares (OLS) regressor.static final classFast Pearson correlation t-test (linear).static interfaceHow we compute residuals.static interfaceUnconditional independence backend rX ⟂ rY → p-value -
Constructor Summary
ConstructorsConstructorDescriptionIndTestGin(DataSet data) Constructs an instance of IndTestGin with the specified dataset.IndTestGin(DataSet data, IndTestGin.Regressor regressor, IndTestGin.UncondIndTest backend) Constructs an instance of IndTestGin with the specified dataset, regressor, and backend components. -
Method Summary
Modifier and TypeMethodDescriptioncheckIndependence(Node x, Node y, Set<Node> cond) Checks the independence of two given nodes, conditioned on a set of other nodes.doublegetAlpha()Returns the significance level for the independence test.getData()Returns the current regressor being used for the independence test.Provides a string description of the current configuration of the independence test, including details about the regressor and backend used, and additional information related to permutations if applicable.doubleReturns the p-value from the most recent independence test.Returns the variables involved in the independence test.booleanReturns the current backend being used for the independence test.voidsetAlpha(double alpha) Sets the significance level for the independence test.voidSets the backend to be used for the independence test.voidsetNumPermutations(int n) Sets the number of permutations to be used for the independence test.voidSets the regressor to be used for the independence test.voidsetVerbose(boolean verbose) Sets the verbosity of the independence test.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.cmu.tetrad.search.test.IndependenceTest
checkIndependence, determines, getCov, getDataSets, getSampleSize, getVariable, getVariableNames, indTestSubset, toString
-
Constructor Details
-
IndTestGin
Constructs an instance of IndTestGin with the specified dataset. Initializes default values for regressor and backend components.- Parameters:
data- the dataset to be used for independence testing
-
IndTestGin
Constructs an instance of IndTestGin with the specified dataset, regressor, and backend components. This constructor allows customization of the regressor and backend used in the independence tests.- Parameters:
data- the dataset to be used for independence testingregressor- the regressor implementation to be used for regression analysisbackend- the unconditional independence test to be used as the backend
-
-
Method Details
-
getDescription
Provides a string description of the current configuration of the independence test, including details about the regressor and backend used, and additional information related to permutations if applicable.- Returns:
- a descriptive string summarizing the configuration of the independence test
-
setNumPermutations
public void setNumPermutations(int n) Sets the number of permutations to be used for the independence test. If n is negative, it will be set to 0.- Parameters:
n- the number of permutations to set
-
setRegressor
Sets the regressor to be used for the independence test. If r is null, it will throw a NullPointerException.- Parameters:
r- the regressor to set
-
setBackend
Sets the backend to be used for the independence test. If b is null, it will throw a NullPointerException.- Parameters:
b- the backend to set
-
getData
Returns the current regressor being used for the independence test.- Specified by:
getDatain interfaceIndependenceTest- Returns:
- the current regressor
-
isVerbose
public boolean isVerbose()Returns the current backend being used for the independence test.- Specified by:
isVerbosein interfaceIndependenceTest- Returns:
- the current backend
-
setVerbose
public void setVerbose(boolean verbose) Sets the verbosity of the independence test.- Specified by:
setVerbosein interfaceIndependenceTest- Parameters:
verbose- True, if so.
-
getVariables
Returns the variables involved in the independence test.- Specified by:
getVariablesin interfaceIndependenceTest- Returns:
- the variables involved in the independence test
-
getAlpha
public double getAlpha()Returns the significance level for the independence test.- Specified by:
getAlphain interfaceIndependenceTest- Returns:
- the significance level
-
setAlpha
public void setAlpha(double alpha) Sets the significance level for the independence test.- Specified by:
setAlphain interfaceIndependenceTest- Parameters:
alpha- the significance level to set
-
checkIndependence
Checks the independence of two given nodes, conditioned on a set of other nodes. It computes residuals for the nodes and uses the backend independence test to determine the independence status along with the p-value.- Specified by:
checkIndependencein interfaceIndependenceTest- Parameters:
x- the first node for the independence testy- the second node for the independence testcond- the set of conditioning nodes- Returns:
- the result of the independence test containing details such as whether the nodes are independent, the p-value, and additional test information
-
getPValue
public double getPValue()Returns the p-value from the most recent independence test.- Returns:
- the p-value of the last independence test
-