Package edu.cmu.tetrad.search.test
Class IndTestDegenerateGaussianLrtFullSample
java.lang.Object
edu.cmu.tetrad.search.test.IndTestDegenerateGaussianLrtFullSample
- All Implemented Interfaces:
- EffectiveSampleSizeSettable,- IndependenceTest,- RowsSettable
public class IndTestDegenerateGaussianLrtFullSample
extends Object
implements IndependenceTest, EffectiveSampleSizeSettable, RowsSettable
The IndTestBasisFunctionLrt class performs conditional independence testing using basis functions within the context
 of a generalized likelihood ratio test (GLRT). This class is designed for evaluating whether two variables are
 conditionally independent given a set of conditioning variables, leveraging statistical and matrix-based
 computations.
 
This class may be compared to the covariance version (see), which is more scalable to large sample sizes. The advantage of this implementation is that rows may be subsetted randomly for individual conditional independence tests. This is not something that can be done using a covariance matrix as a sufficient statistic.
- Author:
- josephramsey, bryanandrews
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs an instance of the IndTestBasisFunctionLrt class.
- 
Method SummaryModifier and TypeMethodDescriptioncheckIndependence(Node x, Node y, Set<Node> z) Tests for the conditional independence of two nodes, x and y, given a set of conditioning nodes z.static org.ejml.simple.SimpleMatrixcomputeOLS(org.ejml.simple.SimpleMatrix B, org.ejml.simple.SimpleMatrix X, double lambda) Computes the Ordinary Least Squares (OLS) solution for a linear system.doublegetAlpha()Returns the significance level of the independence test.getData()Retrieves the data model associated with this instance.getRows()Returns the rows used in the test.Retrieves the list of nodes (variables) associated with this instance.booleanIndicates whether verbose mode is enabled.voidsetAlpha(double alpha) Sets the significance level.voidsetEffectiveSampleSize(int effectiveSampleSize) Sets the sample size to use for the independence test, which may be different from the sample size of the data set or covariance matrix.voidsetLambda(double lambda) Sets the regularization parameter lambda used in statistical computations or tests.voidAllows the user to set which rows are used in the test.voidsetVerbose(boolean verbose) Sets the verbose mode for logging or output behavior.Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.cmu.tetrad.search.IndependenceTestcheckIndependence, determines, getCov, getDataSets, getSampleSize, getVariable, getVariableNames, indTestSubset, toString
- 
Constructor Details- 
IndTestDegenerateGaussianLrtFullSampleConstructs an instance of the IndTestBasisFunctionLrt class. This constructor initializes the object using the provided dataset and configuration parameters for truncation limit, basis type, and basis scale. It processes the input dataset to create the necessary embeddings and initializes key components such as the BIC score for later use in independence testing.- Parameters:
- dataSet- the input data set to be used for the analysis. It must not be null. May contain a mixture of continuous and discrete variables.
- Throws:
- NullPointerException- if the provided dataSet is null.
 
 
- 
- 
Method Details- 
computeOLSpublic static org.ejml.simple.SimpleMatrix computeOLS(org.ejml.simple.SimpleMatrix B, org.ejml.simple.SimpleMatrix X, double lambda) Computes the Ordinary Least Squares (OLS) solution for a linear system. The method applies regularization to the OLS problem to stabilize the solution, particularly in cases where the design matrix B is ill-conditioned or near singular. Regularization is controlled by the lambda parameter, which adds a scaled identity matrix to the design matrix's normal equation.- Parameters:
- B- the design matrix, where rows correspond to observations and columns correspond to features.
- X- the response matrix, where rows correspond to observations and columns to dependent variable outputs.
- lambda- the regularization parameter used to stabilize the solution. Larger values result in stronger regularization.
- Returns:
- the computed OLS solution as a SimpleMatrix object.
 
- 
checkIndependenceTests for the conditional independence of two nodes, x and y, given a set of conditioning nodes z. The method evaluates the independence using a generalized likelihood ratio test and p-value computation.- Specified by:
- checkIndependencein interface- IndependenceTest
- Parameters:
- x- the first Node to test for independence.
- y- the second Node to test for independence.
- z- a set of conditioning nodes; the test checks the independence of x and y conditioned on these nodes.
- Returns:
- an IndependenceResult object containing the result of the independence test, including whether x and y are independent, the computed p-value, and other associated data.
 
- 
getVariablesRetrieves the list of nodes (variables) associated with this instance.- Specified by:
- getVariablesin interface- IndependenceTest
- Returns:
- a list of Node objects representing the variables.
 
- 
getDataRetrieves the data model associated with this instance.- Specified by:
- getDatain interface- IndependenceTest
- Returns:
- the current DataModel instance held by this class.
 
- 
isVerbosepublic boolean isVerbose()Indicates whether verbose mode is enabled. Verbose mode, when enabled, typically results in detailed logging or diagnostic information being output.- Specified by:
- isVerbosein interface- IndependenceTest
- Returns:
- true if verbose mode is enabled; false otherwise.
 
- 
setVerbosepublic void setVerbose(boolean verbose) Sets the verbose mode for logging or output behavior. When verbose mode is enabled, detailed information about the processing can be printed or logged, depending on the implementation.- Specified by:
- setVerbosein interface- IndependenceTest
- Parameters:
- verbose- a boolean flag indicating whether to enable or disable verbose mode. If true, verbose mode is enabled; if false, it is disabled.
 
- 
getAlphapublic double getAlpha()Returns the significance level of the independence test.- Specified by:
- getAlphain interface- IndependenceTest
- Returns:
- this level, default 0.01.
 
- 
setAlphapublic void setAlpha(double alpha) Sets the significance level.- Specified by:
- setAlphain interface- IndependenceTest
- Parameters:
- alpha- This level.
 
- 
setEffectiveSampleSizepublic void setEffectiveSampleSize(int effectiveSampleSize) Sets the sample size to use for the independence test, which may be different from the sample size of the data set or covariance matrix. If not set, the sample size of the data set or covariance matrix is used.- Specified by:
- setEffectiveSampleSizein interface- EffectiveSampleSizeSettable
- Parameters:
- effectiveSampleSize- The sample size to use.
 
- 
getRowsReturns the rows used in the test.- Specified by:
- getRowsin interface- RowsSettable
- Returns:
- The rows used in the test.
 
- 
setRowsAllows the user to set which rows are used in the test. Otherwise, all rows are used, except those with missing values.- Specified by:
- setRowsin interface- RowsSettable
- Parameters:
- rows- The rows to use for the test. Can be null.
 
- 
setLambdapublic void setLambda(double lambda) Sets the regularization parameter lambda used in statistical computations or tests. The lambda parameter often helps to stabilize computations, particularly in the presence of ill-conditioned problems.- Parameters:
- lambda- the regularization parameter to be set. Larger values typically result in stronger regularization. Must be a non-negative value.
 
 
-