Interface ICovarianceMatrix

All Superinterfaces:
DataModel, KnowledgeTransferable, Serializable, TetradSerializable, VariableSource
All Known Implementing Classes:
CorrelationMatrix, CorrelationMatrixOnTheFly, CovarianceMatrix, CovarianceMatrixOnTheFly

public interface ICovarianceMatrix extends DataModel
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 Type
    Method
    Description
    void
    Clears the current selection of variables in the covariance matrix.
    int
    Retrieves the dimension of the covariance matrix.
    Retrieves the knowledge associated with the ICovarianceMatrix.
    Retrieves the covariance matrix.
    Gets the name of the covariance matrix.
    int
    Retrieves 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.
    int
    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.
    double
    getValue(int i, int j)
    Retrieves the value from the covariance matrix at the specified row and column indices.
    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.
    boolean
    isSelected(Node variable)
    Checks if the specified node is selected in the covariance matrix.
    void
    Removes variables from the covariance matrix, retaining only the variables specified in the provided list.
    void
    select(Node variable)
    Selects a specified variable in the covariance matrix.
    void
    Sets the knowledge associated with the ICovarianceMatrix.
    void
    setMatrix(Matrix matrix)
    Sets the covariance matrix.
    void
    Sets the name of the covariance matrix.
    void
    setSampleSize(int sampleSize)
    Sets the sample size used in the covariance matrix.
    void
    setValue(int i, int j, double v)
    Sets the value of the covariance matrix at the specified indices.
    void
    setVariables(List<Node> variables)
    Sets the list of Node variables for the covariance matrix.
    Renders the covariance matrix as a string representation.

    Methods inherited from interface edu.cmu.tetrad.data.DataModel

    copy, isContinuous, isDiscrete, isMixed
  • Method Details

    • getVariables

      List<Node> getVariables()
      Retrieves the list of Node variables for the covariance matrix.
      Specified by:
      getVariables in interface VariableSource
      Returns:
      a list of Node objects representing the variables in the covariance matrix.
    • setVariables

      void setVariables(List<Node> variables)
      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

      List<String> getVariableNames()
      Retrieves the list of names of the variables in the covariance matrix.
      Specified by:
      getVariableNames in interface VariableSource
      Returns:
      a list of strings representing the names of the variables.
    • getVariableName

      String getVariableName(int index)
      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.
      Specified by:
      getName in interface DataModel
      Returns:
      the name of the covariance matrix as a String
    • setName

      void setName(String name)
      Sets the name of the covariance matrix.
      Specified by:
      setName in interface DataModel
      Parameters:
      name - the new name of the covariance matrix
    • getKnowledge

      Knowledge getKnowledge()
      Retrieves the knowledge associated with the ICovarianceMatrix.
      Specified by:
      getKnowledge in interface KnowledgeTransferable
      Returns:
      the Knowledge object representing the associated knowledge
    • setKnowledge

      void setKnowledge(Knowledge knowledge)
      Sets the knowledge associated with the ICovarianceMatrix.
      Specified by:
      setKnowledge in interface KnowledgeTransferable
      Parameters:
      knowledge - the knowledge to set
    • getSubmatrix

      ICovarianceMatrix getSubmatrix(int[] indices)
      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

      ICovarianceMatrix getSubmatrix(List<String> submatrixVarNames)
      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

      ICovarianceMatrix getSubmatrix(String[] submatrixVarNames)
      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 index
      j - 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

      void setMatrix(Matrix matrix)
      Sets the covariance matrix.
      Parameters:
      matrix - the matrix to set
    • select

      void select(Node variable)
      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

      boolean isSelected(Node variable)
      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

      List<String> 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.
      Specified by:
      toString in interface DataModel
      Overrides:
      toString in class Object
      Returns:
      a string representation of the covariance matrix.
    • getVariable

      Node getVariable(String name)
      Retrieves a Node instance from the covariance matrix corresponding to the specified variable name.
      Specified by:
      getVariable in interface DataModel
      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 index
      j - the column index
      v - the value to set at the specified indices
    • removeVariables

      void removeVariables(List<String> remaining)
      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

      Matrix getSelection(int[] rows, int[] cols)
      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 Matrix object containing the selected rows and columns.