Class MixedDataBox

java.lang.Object
edu.cmu.tetrad.data.MixedDataBox
All Implemented Interfaces:
DataBox, TetradSerializable, Serializable

public class MixedDataBox extends Object implements DataBox
Stores a 2D array of double continuousData. Note that the missing value marker for this box is -99.
See Also:
  • Constructor Details

    • MixedDataBox

      public MixedDataBox(List<Node> variables, int numRows)
      The variables here are used only to determine which columns are discrete and which are continuous; bounds checking is not done.
    • MixedDataBox

      public MixedDataBox(List<Node> variables, int numRows, double[][] continuousData, int[][] discreteData)
      This constructor allows other data readers to populate the fields directly.
      Parameters:
      variables - list of discrete and continuous variables
      numRows - number of cases in the dataset
      continuousData - continuous data
      discreteData - discrete data
  • Method Details

    • serializableInstance

      public static BoxDataSet serializableInstance()
      Generates a simple exemplar of this class to test serialization.
    • numRows

      public int numRows()
      Specified by:
      numRows in interface DataBox
      Returns:
      the number of rows in this continuousData box.
    • numCols

      public int numCols()
      Specified by:
      numCols in interface DataBox
      Returns:
      the number of columns in this continuousData box.
    • set

      public void set(int row, int col, Number value)
      Sets the value at the given row/column to the given Number value. The value used is number.doubleValue().
      Specified by:
      set in interface DataBox
    • get

      public Number get(int row, int col)
      Specified by:
      get in interface DataBox
      Returns:
      the Number value at the given row and column. If the value is missing (-99), null, is returned.
    • copy

      public DataBox copy()
      Specified by:
      copy in interface DataBox
      Returns:
      a copy of this continuousData box.
    • like

      public DataBox like()
      Specified by:
      like in interface DataBox
      Returns:
      a DataBox of type DoubleDataBox, but with the given dimensions.
    • addVariable

      public void addVariable(Node variable)
    • viewSelection

      public DataBox viewSelection(int[] rows, int[] cols)
      Specified by:
      viewSelection in interface DataBox
      Returns:
      this data box, restricted to the given rows and columns.
    • getContinuousData

      public double[][] getContinuousData()
    • getDiscreteData

      public int[][] getDiscreteData()