Package edu.cmu.tetrad.data
Class CorrelationMatrixOnTheFly
java.lang.Object
edu.cmu.tetrad.data.CorrelationMatrixOnTheFly
- All Implemented Interfaces:
- DataModel,- ICovarianceMatrix,- KnowledgeTransferable,- VariableSource,- TetradSerializable,- Serializable
Stores a covariance matrix together with variable names and sample size,
 intended as a representation of a data set. When constructed from a
 continuous data set, the matrix is not checked for positive definiteness;
 however, when a covariance matrix is supplied, its positive definiteness is
 always checked. If the sample size is less than the number of variables, the
 positive definiteness is "spot-checked"--that is, checked for various
 submatrices.
- Author:
- Joseph Ramsey jdramsey@andrew.cmu.edu
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a new covariance matrix from the given data set.
- 
Method SummaryModifier and TypeMethodDescriptionfinal voidcopy()final intfinal Knowledgefinal Matrixfinal StringgetName()Gets the name of the covariance matrix.final intThe size of the sample used to calculated this covariance matrix.getSelection(int[] rows, int[] cols) final intgetSize()final ICovarianceMatrixgetSubmatrix(int[] indices) getSubmatrix(String[] submatrixVarNames) final ICovarianceMatrixgetSubmatrix(List<String> submatrixVarNames) final doublegetValue(int i, int j) getVariable(String name) final StringgetVariableName(int index) booleanbooleanbooleanisMixed()final booleanisSelected(Node variable) booleanvoidremoveVariables(List<String> remaining) final voidstatic ICovarianceMatrixGenerates a simple exemplar of this class to test serialization.final voidsetKnowledge(Knowledge knowledge) Associates knowledge with this data.voidfinal voidSets the name of the covariance matrix.final voidsetSampleSize(int sampleSize) voidsetValue(int i, int j, double v) voidsetVariables(List<Node> variables) voidsetVerbose(boolean verbose) final StringtoString()Prints out the matrix
- 
Constructor Details- 
CorrelationMatrixOnTheFlyConstructs a new covariance matrix from the given data set. If dataSet is a BoxDataSet with a VerticalDoubleDataBox, the data will be mean-centered by the constructor; is non-mean-centered version of the data is needed, the data should be copied before being send into the constructor.- Throws:
- IllegalArgumentException- if this is not a continuous data set.
 
 
- 
- 
Method Details- 
serializableInstanceGenerates a simple exemplar of this class to test serialization.
- 
getVariables- Specified by:
- getVariablesin interface- ICovarianceMatrix
- Specified by:
- getVariablesin interface- VariableSource
- Returns:
- the list of variables (unmodifiable).
 
- 
getVariableNames- Specified by:
- getVariableNamesin interface- ICovarianceMatrix
- Specified by:
- getVariableNamesin interface- VariableSource
- Returns:
- the variable names, in order.
 
- 
getVariableName- Specified by:
- getVariableNamein interface- ICovarianceMatrix
- Returns:
- the variable name at the given index.
 
- 
getDimensionpublic final int getDimension()- Specified by:
- getDimensionin interface- ICovarianceMatrix
- Returns:
- the dimension of the covariance matrix.
 
- 
getSampleSizepublic final int getSampleSize()The size of the sample used to calculated this covariance matrix.- Specified by:
- getSampleSizein interface- ICovarianceMatrix
- Returns:
- The sample size (> 0).
 
- 
getNameGets the name of the covariance matrix.- Specified by:
- getNamein interface- DataModel
- Specified by:
- getNamein interface- ICovarianceMatrix
- Returns:
- the name of the data model (may be null).
 
- 
setNameSets the name of the covariance matrix.- Specified by:
- setNamein interface- DataModel
- Specified by:
- setNamein interface- ICovarianceMatrix
 
- 
getKnowledge- Specified by:
- getKnowledgein interface- ICovarianceMatrix
- Specified by:
- getKnowledgein interface- KnowledgeTransferable
- Returns:
- the knowledge associated with this data.
 
- 
setKnowledgeAssociates knowledge with this data.- Specified by:
- setKnowledgein interface- ICovarianceMatrix
- Specified by:
- setKnowledgein interface- KnowledgeTransferable
 
- 
getSubmatrix- Specified by:
- getSubmatrixin interface- ICovarianceMatrix
- Returns:
- a submatrix of the covariance matrix with variables in the given order.
 
- 
getSubmatrix- Specified by:
- getSubmatrixin interface- ICovarianceMatrix
 
- 
getSubmatrix- Specified by:
- getSubmatrixin interface- ICovarianceMatrix
- Returns:
- a submatrix of this matrix, with variables in the given order.
 
- 
getValuepublic final double getValue(int i, int j) - Specified by:
- getValuein interface- ICovarianceMatrix
- Returns:
- the value of element (i,j) in the matrix
 
- 
setMatrix- Specified by:
- setMatrixin interface- ICovarianceMatrix
 
- 
setSampleSizepublic final void setSampleSize(int sampleSize) - Specified by:
- setSampleSizein interface- ICovarianceMatrix
 
- 
getSizepublic final int getSize()- Specified by:
- getSizein interface- ICovarianceMatrix
- Returns:
- the size of the square matrix.
 
- 
getMatrix- Specified by:
- getMatrixin interface- ICovarianceMatrix
- Returns:
- a copy of the covariance matrix.
 
- 
select- Specified by:
- selectin interface- ICovarianceMatrix
 
- 
clearSelectionpublic final void clearSelection()- Specified by:
- clearSelectionin interface- ICovarianceMatrix
 
- 
isSelected- Specified by:
- isSelectedin interface- ICovarianceMatrix
 
- 
getSelectedVariableNames- Specified by:
- getSelectedVariableNamesin interface- ICovarianceMatrix
 
- 
toStringPrints out the matrix
- 
isContinuouspublic boolean isContinuous()- Specified by:
- isContinuousin interface- DataModel
 
- 
isDiscretepublic boolean isDiscrete()- Specified by:
- isDiscretein interface- DataModel
 
- 
isMixedpublic boolean isMixed()
- 
setVariables- Specified by:
- setVariablesin interface- ICovarianceMatrix
 
- 
isVerbosepublic boolean isVerbose()
- 
setVerbosepublic void setVerbose(boolean verbose) 
- 
getSelection- Specified by:
- getSelectionin interface- ICovarianceMatrix
 
- 
getVariable- Specified by:
- getVariablein interface- DataModel
- Specified by:
- getVariablein interface- ICovarianceMatrix
 
- 
copy
- 
setValuepublic void setValue(int i, int j, double v) - Specified by:
- setValuein interface- ICovarianceMatrix
 
- 
removeVariables- Specified by:
- removeVariablesin interface- ICovarianceMatrix
 
 
-