Package edu.cmu.tetrad.bayes
Class CellTableProbs
java.lang.Object
edu.cmu.tetrad.bayes.CellTableProbs
Estimates probabilities from data by constructing the entire cell count table for the data.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Constructor Summary
ConstructorsConstructorDescriptionCellTableProbs
(DataSet dataSet) Creates a cell count table for the given data set. -
Method Summary
Modifier and TypeMethodDescriptiondouble
getCellProb
(int[] variableValues) Calculates the probability of a cell corresponding to the given variable values.double
getConditionalProb
(Proposition assertion, Proposition condition) Calculates the conditional probability of an assertion given a condition.Getter for the fielddataSet
.double
getProb
(Proposition assertion) This method calculates the probability of a given proposition.getVariables.
-
Constructor Details
-
CellTableProbs
Creates a cell count table for the given data set.- Parameters:
dataSet
- the data set to be used in the table.
-
-
Method Details
-
getCellProb
public double getCellProb(int[] variableValues) Calculates the probability of a cell corresponding to the given variable values.- Parameters:
variableValues
- an array of integers representing the values of the variables in the cell.- Returns:
- the probability of the cell corresponding to the given variable values.
-
getProb
This method calculates the probability of a given proposition.- Parameters:
assertion
- a Proposition object representing the proposition for which the probability is calculated.- Returns:
- the probability of the given proposition.
-
getConditionalProb
Calculates the conditional probability of an assertion given a condition.- Parameters:
assertion
- AProposition
representing the assertion.condition
- AProposition
representing the condition.- Returns:
- The conditional probability of the assertion given the condition.
- Throws:
IllegalArgumentException
- if the assertion and condition are not for the same Bayes IM, or if the variables in the assertion and data set are either different or in a different order.
-
getDataSet
Getter for the field
dataSet
.- Returns:
- the dataset that this is estimating probabilities for.
-
getVariables
-