Class TimeSeriesData

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

public final class TimeSeriesData extends Object implements DataModel
Stores time series data as a list of continuous columns.
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • TimeSeriesData

      public TimeSeriesData(Matrix matrix, List<String> varNames)
      Constructs a new time series data contains for the given row-major data array and the given list of variables. Each row of the data, data[i], contains a measured for each variable (in order) for a particular time. The series of times is in increasing order.
      Parameters:
      matrix - a Matrix object
      varNames - a List object
  • Method Details

    • serializableInstance

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

      public String getName()

      Getter for the field name.

      Specified by:
      getName in interface DataModel
      Returns:
      a String object
    • setName

      public void setName(String name)
      Sets the name of the data model (may be null).
      Specified by:
      setName in interface DataModel
      Parameters:
      name - the name to set
    • isContinuous

      public boolean isContinuous()

      isContinuous.

      Specified by:
      isContinuous in interface DataModel
      Returns:
      true if the data model is continuous, false otherwise.
    • isDiscrete

      public boolean isDiscrete()

      isDiscrete.

      Specified by:
      isDiscrete in interface DataModel
      Returns:
      true if the data model is discrete, false otherwise.
    • isMixed

      public boolean isMixed()

      isMixed.

      Specified by:
      isMixed in interface DataModel
      Returns:
      true if the data model is mixed continuous/discrete, false otherwise.
    • getVariable

      public Node getVariable(String name)

      getVariable.

      Specified by:
      getVariable in interface DataModel
      Parameters:
      name - a String object
      Returns:
      the variable with the given name, or null if no such variable exists.
    • copy

      public DataModel copy()

      copy.

      Specified by:
      copy in interface DataModel
      Returns:
      a copy of the data model.
    • getVariables

      public List<Node> getVariables()

      getVariables.

      Specified by:
      getVariables in interface VariableSource
      Returns:
      a List object
    • getKnowledge

      public Knowledge getKnowledge()

      Getter for the field knowledge.

      Specified by:
      getKnowledge in interface KnowledgeTransferable
      Returns:
      a Knowledge object
    • setKnowledge

      public void setKnowledge(Knowledge knowledge)
      Sets knowledge to a copy of the given object.
      Specified by:
      setKnowledge in interface KnowledgeTransferable
      Parameters:
      knowledge - the knowledge to set
    • getVariableNames

      public List<String> getVariableNames()

      getVariableNames.

      Specified by:
      getVariableNames in interface VariableSource
      Returns:
      (a copy of) the List of Variables for the data set, in the order of their columns.
    • getData

      public Matrix getData()

      getData.

      Returns:
      a Matrix object
    • getNumTimePoints

      public int getNumTimePoints()

      getNumTimePoints.

      Returns:
      an int
    • getNumVars

      public int getNumVars()

      getNumVars.

      Returns:
      an int
    • getDatum

      public double getDatum(int row, int col)

      getDatum.

      Parameters:
      row - an int
      col - an int
      Returns:
      a double