Package edu.cmu.tetrad.data
Interface ICovarianceMatrix
- All Superinterfaces:
DataModel,KnowledgeTransferable,Serializable,TetradSerializable,VariableSource
- All Known Implementing Classes:
CorrelationMatrix,CorrelationMatrixOnTheFly,CovarianceMatrix,CovarianceMatrixOnTheFly
Interface for covariance matrices. Implemented in different ways. See implementations.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Field Summary
Fields inherited from interface edu.cmu.tetrad.data.DataModel
serialVersionUID -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the current selection of variables in the covariance matrix.intRetrieves the dimension of the covariance matrix.Retrieves the knowledge associated with the ICovarianceMatrix.Retrieves the covariance matrix.getName()Gets the name of the covariance matrix.intRetrieves the sample size used in the covariance matrix.Retrieves a list of names of the currently selected variables.getSelection(int[] rows, int[] cols) Returns a submatrix based on the specified rows and columns.intgetSize()Retrieves the size of the matrix.getSubmatrix(int[] indices) Returns a submatrix of the covariance matrix, including only the specified variables.getSubmatrix(String[] submatrixVarNames) Returns a submatrix of the covariance matrix, including only the specified variables.getSubmatrix(List<String> submatrixVarNames) Returns a submatrix of the covariance matrix, including only the specified variables.doublegetValue(int i, int j) Retrieves the value from the covariance matrix at the specified row and column indices.getVariable(String name) Retrieves a Node instance from the covariance matrix corresponding to the specified variable name.getVariableName(int index) Retrieves the name of the variable at the specified index from the covariance matrix.Retrieves the list of names of the variables in the covariance matrix.Retrieves the list of Node variables for the covariance matrix.booleanisSelected(Node variable) Checks if the specified node is selected in the covariance matrix.voidremoveVariables(List<String> remaining) Removes variables from the covariance matrix, retaining only the variables specified in the provided list.voidSelects a specified variable in the covariance matrix.voidsetKnowledge(Knowledge knowledge) Sets the knowledge associated with the ICovarianceMatrix.voidSets the covariance matrix.voidSets the name of the covariance matrix.voidsetSampleSize(int sampleSize) Sets the sample size used in the covariance matrix.voidsetValue(int i, int j, double v) Sets the value of the covariance matrix at the specified indices.voidsetVariables(List<Node> variables) Sets the list of Node variables for the covariance matrix.toString()Renders the covariance matrix as a string representation.Methods inherited from interface edu.cmu.tetrad.data.DataModel
copy, isContinuous, isDiscrete, isMixed
-
Method Details
-
getVariables
Retrieves the list of Node variables for the covariance matrix.- Specified by:
getVariablesin interfaceVariableSource- Returns:
- a list of Node objects representing the variables in the covariance matrix.
-
setVariables
Sets the list of Node variables for the covariance matrix.- Parameters:
variables- a list of Node objects representing the variables to be set in the covariance matrix
-
getVariableNames
Retrieves the list of names of the variables in the covariance matrix.- Specified by:
getVariableNamesin interfaceVariableSource- Returns:
- a list of strings representing the names of the variables.
-
getVariableName
Retrieves the name of the variable at the specified index from the covariance matrix.- Parameters:
index- the index of the variable whose name is to be retrieved- Returns:
- the name of the variable at the specified index
-
getDimension
int getDimension()Retrieves the dimension of the covariance matrix.- Returns:
- the dimension of the covariance matrix as an integer
-
getSampleSize
int getSampleSize()Retrieves the sample size used in the covariance matrix.- Returns:
- the sample size as an integer
-
setSampleSize
void setSampleSize(int sampleSize) Sets the sample size used in the covariance matrix.- Parameters:
sampleSize- the sample size to be set
-
getName
String getName()Gets the name of the covariance matrix. -
setName
Sets the name of the covariance matrix. -
getKnowledge
Knowledge getKnowledge()Retrieves the knowledge associated with the ICovarianceMatrix.- Specified by:
getKnowledgein interfaceKnowledgeTransferable- Returns:
- the Knowledge object representing the associated knowledge
-
setKnowledge
Sets the knowledge associated with the ICovarianceMatrix.- Specified by:
setKnowledgein interfaceKnowledgeTransferable- Parameters:
knowledge- the knowledge to set
-
getSubmatrix
Returns a submatrix of the covariance matrix, including only the specified variables.- Parameters:
indices- an array of integers specifying the indices of the variables to include in the submatrix- Returns:
- a submatrix of the covariance matrix that includes only the specified variables
-
getSubmatrix
Returns a submatrix of the covariance matrix, including only the specified variables.- Parameters:
submatrixVarNames- a list of strings specifying the variable names to include in the submatrix- Returns:
- a submatrix of the covariance matrix that includes only the specified variables
-
getSubmatrix
Returns a submatrix of the covariance matrix, including only the specified variables.- Parameters:
submatrixVarNames- an array of strings specifying the variable names to include in the submatrix- Returns:
- a submatrix of the covariance matrix that includes only the specified variables
-
getValue
double getValue(int i, int j) Retrieves the value from the covariance matrix at the specified row and column indices.- Parameters:
i- the row indexj- the column index- Returns:
- the value at the specified indices in the matrix
-
getSize
int getSize()Retrieves the size of the matrix.- Returns:
- the size of the square matrix.
-
getMatrix
Matrix getMatrix()Retrieves the covariance matrix.- Returns:
- a Matrix object representing the covariance matrix
-
setMatrix
Sets the covariance matrix.- Parameters:
matrix- the matrix to set
-
select
Selects a specified variable in the covariance matrix.- Parameters:
variable- the node variable to be selected
-
clearSelection
void clearSelection()Clears the current selection of variables in the covariance matrix. This method resets any selected variables to their default unselected state. -
isSelected
Checks if the specified node is selected in the covariance matrix.- Parameters:
variable- the node to check for selection- Returns:
- true if the node is selected, false otherwise
-
getSelectedVariableNames
Retrieves a list of names of the currently selected variables.- Returns:
- a list of selected variable names.
-
toString
String toString()Renders the covariance matrix as a string representation. -
getVariable
Retrieves a Node instance from the covariance matrix corresponding to the specified variable name.- Specified by:
getVariablein interfaceDataModel- Parameters:
name- the name of the variable to retrieve- Returns:
- the Node associated with the specified variable name
-
setValue
void setValue(int i, int j, double v) Sets the value of the covariance matrix at the specified indices.- Parameters:
i- the row indexj- the column indexv- the value to set at the specified indices
-
removeVariables
Removes variables from the covariance matrix, retaining only the variables specified in the provided list.- Parameters:
remaining- a list of variable names to retain in the covariance matrix.
-
getSelection
Returns a submatrix based on the specified rows and columns.- Parameters:
rows- an array of integers representing the row indices to be included in the selection.cols- an array of integers representing the column indices to be included in the selection.- Returns:
- a
Matrixobject containing the selected rows and columns.
-