Class Histogram

java.lang.Object
edu.cmu.tetrad.data.Histogram

public class Histogram extends Object
Model for a conditional histogram for mixed continuous and discrete variables.
Author:
josephramsey
  • Constructor Details

    • Histogram

      public Histogram(DataSet dataSet, String target, boolean removeZeroPointsPerPlot)
      This histogram is for variables in a particular data set. These may be continuous or discrete.
  • Method Details

    • addConditioningVariable

      public void addConditioningVariable(String variable, double low, double high)
      Adds a continuous conditioning variables, conditioning on a range of values.
      Parameters:
      variable - The name of the variable in the data set.
      low - The low end of the conditioning range.
      high - The high end of the conditioning range.
    • addConditioningVariable

      public void addConditioningVariable(String variable, int value)
      Adds a discrete conditioning variable, conditioning on a particular value.
      Parameters:
      variable - The name of the variable in the data set.
      value - The value to condition on.
    • removeConditioningVariable

      public void removeConditioningVariable(String variable)
      Removes a conditioning variable.
      Parameters:
      variable - The name of the conditioning variable to remove.
    • setNumBins

      public void setNumBins(int numBins)
      For a continuous target, sets the number of bins for the histogram.
      Parameters:
      numBins - The number of bins.
    • getFrequencies

      public int[] getFrequencies()
      Returns:
      the counts for the histogram, one count for each target, in an integer array.
    • getMax

      public double getMax()
      For a continuous target, returns the maximum value of the values histogrammed, for the unconditioned data.
    • getMin

      public double getMin()
      For a continuous target, returns the minimum value of the values histogrammed, for the unconditioned data.
    • getN

      public int getN()
      For a continuous target, returns the number of values histogrammed. This may be less than the sample size of the data set because of conditioning.
    • getContinuousData

      public double[] getContinuousData(String variable)
      A convenience method to return the data for a particular named continuous variable.
      Parameters:
      variable - The name of the variable.
    • getDataSet

      public DataSet getDataSet()
      Returns:
      the data set for this histogram.
    • getTarget

      public String getTarget()
      Returns:
      the target node being histogrammed. Could be continuous or discrete.
    • getTargetNode

      public Node getTargetNode()