Package edu.cmu.tetrad.data
Class Histogram
java.lang.Object
edu.cmu.tetrad.data.Histogram
Model for a conditional histogram for mixed continuous and discrete variables.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConditioningVariable(String variable, double low, double high) Adds a continuous conditioning variables, conditioning on a range of values.voidaddConditioningVariable(String variable, int value) Adds a discrete conditioning variable, conditioning on a particular value.double[]getContinuousData(String variable) A convenience method to return the data for a particular named continuous variable.Getter for the fielddataSet.int[]getFrequencies.doublegetMax()For a continuous target, returns the maximum value of the values histogrammed, for the unconditioned data.doublegetMin()For a continuous target, returns the minimum value of the values histogrammed, for the unconditioned data.intgetN()For a continuous target, returns the number of values histogrammed.Getter for the fieldtarget.getTargetNode.voidremoveConditioningVariable(String variable) Removes a conditioning variable.voidsetNumBins(int numBins) For a continuous target, sets the number of bins for the histogram.
-
Constructor Details
-
Method Details
-
addConditioningVariable
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
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
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()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.- Returns:
- a double
-
getMin
public double getMin()For a continuous target, returns the minimum value of the values histogrammed, for the unconditioned data.- Returns:
- a double
-
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.- Returns:
- a int
-
getContinuousData
A convenience method to return the data for a particular named continuous variable.- Parameters:
variable- The name of the variable.- Returns:
- an array of objects
-
getDataSet
Getter for the field
dataSet.- Returns:
- the data set for this histogram.
-
getTarget
Getter for the field
target.- Returns:
- the target node being histogrammed. Could be continuous or discrete.
-
getTargetNode
getTargetNode.
- Returns:
- a
Nodeobject
-