Package edu.cmu.tetrad.search.score
Class PoissonPriorScore
java.lang.Object
edu.cmu.tetrad.search.score.PoissonPriorScore
- All Implemented Interfaces:
Score,EffectiveSampleSizeSettable
Implements Poisson prior score, a novel (unpubished) score that replaces the penalty term in BIC by the log of the
Poisson distribution. The Poisson distribution has a lambda parameter, which is made a parameter of this score and
acts like a structure prior for the score.
Here is the Wikipedia page for the Poisson distribution, for reference:
As for all scores in Tetrad, higher scores mean more dependence, and negative scores indicate independence.
- Version:
- $Id: $Id
- Author:
- bryanandrews, josephramsey
-
Constructor Summary
ConstructorsConstructorDescriptionPoissonPriorScore(DataSet dataSet, boolean precomputeCovariances) Constructs the score using a covariance matrix.PoissonPriorScore(ICovarianceMatrix covariances) Constructs the score using a covariance matrix. -
Method Summary
Modifier and TypeMethodDescriptionbooleandetermines(List<Node> z, Node y) Returns true iff the score determines the edge between x and y.Returns the covariance matrix.getData()Returns the data set.intReturns the effective sample size.intReturns the max degree, by default 1000.intReturns the sample size.The variables of the score.booleanisEffectEdge(double bump) Returns true iff the edge between x and y is an effect edge.doublelocalScore(int i, int... parents) Returns the score of the node at index i, given its parents.doublelocalScoreDiff(int x, int y, int[] z) Returns the score difference of the graph.voidsetEffectiveSampleSize(int nEff) Sets the effective sample size, or -1 if the actual sample size should be used.voidsetLambda(double lambda) Sets the lambda parameter.voidsetSingularityLambda(double singularityLambda) Sets the Singularity lambda value used in computations.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.cmu.tetrad.search.score.Score
append, getVariable, localScore, localScore, localScoreDiff, toString
-
Constructor Details
-
PoissonPriorScore
Constructs the score using a covariance matrix.- Parameters:
covariances- The covariance matrix.
-
PoissonPriorScore
Constructs the score using a covariance matrix.- Parameters:
dataSet- The dataset.precomputeCovariances- Whether the covariances should be precomputed or computed on the fly. True if
-
-
Method Details
-
localScoreDiff
public double localScoreDiff(int x, int y, int[] z) Returns the score difference of the graph.Returns the score difference localScore(y | z, x) - localScore(y | z).
- Specified by:
localScoreDiffin interfaceScore- Parameters:
x- A node.y- TAhe node.z- A set of nodes.- Returns:
- The score difference.
-
localScore
Returns the score of the node at index i, given its parents.- Specified by:
localScorein interfaceScore- Parameters:
i- The index of the node.parents- The indices of the node's parents.- Returns:
- The score, or NaN if the score cannot be calculated.
- Throws:
RuntimeException- if any.
-
getCovariances
Returns the covariance matrix.- Returns:
- The covariance matrix.
-
getSampleSize
public int getSampleSize()Returns the sample size.- Specified by:
getSampleSizein interfaceScore- Returns:
- This size.
-
isEffectEdge
public boolean isEffectEdge(double bump) Returns true iff the edge between x and y is an effect edge.Returns true if the edge with the given bump is an effect edge.
- Specified by:
isEffectEdgein interfaceScore- Parameters:
bump- The bump.- Returns:
- True iff the edge between x and y is an effect edge.
-
getVariables
The variables of the score.Returns the variables.
- Specified by:
getVariablesin interfaceScore- Returns:
- This list.
-
getMaxDegree
public int getMaxDegree()Returns the max degree, by default 1000.Returns the max degree.
- Specified by:
getMaxDegreein interfaceScore- Returns:
- The max degree.
-
determines
Returns true iff the score determines the edge between x and y.Returns true if z determines y.
- Specified by:
determinesin interfaceScore- Parameters:
z- The set of nodes.y- The node.- Returns:
- True iff the score determines the edge between x and y.
-
getData
Returns the data set.- Returns:
- The data set.
-
setLambda
public void setLambda(double lambda) Sets the lambda parameter.- Parameters:
lambda- The lambda parameter.
-
setSingularityLambda
public void setSingularityLambda(double singularityLambda) Sets the Singularity lambda value used in computations.- Parameters:
singularityLambda- The Singularity lambda parameter to set.
-
getEffectiveSampleSize
public int getEffectiveSampleSize()Description copied from interface:EffectiveSampleSizeSettableReturns the effective sample size.- Specified by:
getEffectiveSampleSizein interfaceEffectiveSampleSizeSettable- Returns:
- the effective sample size
-
setEffectiveSampleSize
public void setEffectiveSampleSize(int nEff) Description copied from interface:EffectiveSampleSizeSettableSets the effective sample size, or -1 if the actual sample size should be used.- Specified by:
setEffectiveSampleSizein interfaceEffectiveSampleSizeSettable- Parameters:
nEff- the effective sample size
-