Class CorrelationMatrix

java.lang.Object
edu.cmu.tetrad.data.CovarianceMatrix
edu.cmu.tetrad.data.CorrelationMatrix
All Implemented Interfaces:
DataModel, ICovarianceMatrix, KnowledgeTransferable, VariableSource, TetradSerializable, Serializable

public final class CorrelationMatrix extends CovarianceMatrix
Stores a correlation matrix together with variable names and sample size; intended as a representation of a data set.
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • CorrelationMatrix

      public CorrelationMatrix(ICovarianceMatrix matrix)
      Constructs a new correlation matrix using the covariances in the given covariance matrix.
      Parameters:
      matrix - a ICovarianceMatrix object
    • CorrelationMatrix

      public CorrelationMatrix(DataSet dataSet)
      Constructs a new correlation matrix from the the given DataSet.
      Parameters:
      dataSet - a DataSet object
    • CorrelationMatrix

      public CorrelationMatrix(List<Node> variables, Matrix matrix, int sampleSize)
      Constructs a correlation matrix data set using the given information. The matrix matrix is internally converted to a correlation matrix.
      Parameters:
      variables - a List object
      matrix - a Matrix object
      sampleSize - a int
  • Method Details

    • serializableInstance

      public static CorrelationMatrix serializableInstance()
      Generates a simple exemplar of this class to test serialization.
      Returns:
      a CorrelationMatrix object
    • setMatrix

      public void setMatrix(Matrix matrix)
      Sets the covariance matrix.
      Specified by:
      setMatrix in interface ICovarianceMatrix
      Overrides:
      setMatrix in class CovarianceMatrix
      Parameters:
      matrix - the matrix to set
    • getSelection

      public Matrix getSelection(int[] rows, int[] cols)
      Returns a submatrix based on the specified rows and columns.
      Specified by:
      getSelection in interface ICovarianceMatrix
      Overrides:
      getSelection in class CovarianceMatrix
      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.
    • getSubCorrMatrix

      public CorrelationMatrix getSubCorrMatrix(String[] submatrixVarNames)

      getSubCorrMatrix.

      Parameters:
      submatrixVarNames - an array of String objects
      Returns:
      a submatrix, returning as a correlation matrix, with variables in the given order.