Interface Statistic

All Superinterfaces:
Serializable
All Known Implementing Classes:
AdjacencyFn, AdjacencyFp, AdjacencyFpr, AdjacencyPrecision, AdjacencyRecall, AdjacencyTn, AdjacencyTp, AdjacencyTpr, AncestorF1, AncestorPrecision, AncestorRecall, AncestralPrecision, AncestralRecall, ArrowheadFn, ArrowheadFp, ArrowheadFpr, ArrowheadPrecision, ArrowheadPrecisionCommonEdges, ArrowheadRecall, ArrowheadRecallCommonEdges, ArrowheadTn, ArrowheadTp, AverageDegreeEst, AverageDegreeTrue, BicDiff, BicDiffPerRecord, BicEst, BicTrue, BidirectedEst, BidirectedFP, BidirectedLatentExistsLatentCommonCause, BidirectedLatentPrecision, BidirectedPrecision, BidirectedRecall, BidirectedTP, BidirectedTrue, CirclePrecision, CircleRecall, CommonAncestorFalseNegativeBidirected, CommonAncestorFalsePositiveBidirected, CommonAncestorTruePositiveBidirected, CommonMeasuredAncestorRecallBidirected, CorrectSkeleton, DefiniteDirectedPathPrecision, DefiniteDirectedPathRecall, DensityEst, DensityTrue, ElapsedCpuTime, F1Adj, F1All, F1Arrow, F1Circle, F1Tail, FalseNegativesAdjacencies, FalsePositiveAdjacencies, FBetaAdj, FractionDependentUnderAlternative, FractionDependentUnderNull, GraphExactlyRight, IdaAverageSquaredDistance, IdaCheckAvgMaxSquaredDiffEstTrue, IdaCheckAvgMinSquaredDiffEstTrue, IdaCheckAvgSquaredDifference, IdaMaximumSquaredDifference, IdaMinimumSquaredDifference, ImpliedArrowOrientationRatioEst, ImpliedArrowOrientationRatioEst2, ImpliedOrientationRatioEst, ImpliesLegalMag, KnowledgeSatisfied, LatentCommonAncestorFalseNegativeBidirected, LatentCommonAncestorFalsePositiveBidirected, LatentCommonAncestorRecallBidirected, LatentCommonAncestorTruePositiveBidirected, LegalCpdag, LegalPag, LocalGraphPrecision, LocalGraphRecall, MagCgScore, MagDgScore, MagSemScore, MarkovCheckAdPasses, MarkovCheckAdPassesBestOf10, MarkovCheckAndersonDarlingP, MarkovCheckAndersonDarlingPBestOf10, MarkovCheckBinomialP, MarkovCheckBinomialPBestOf10, MarkovCheckFdrCutoffP, MarkovCheckFractionDependentH0, MarkovCheckFractionDependentH1, MarkovCheckKolmogorovSmirnoffP, MarkovCheckKolmogorovSmirnoffPBestOf10, MarkovCheckKsPasses, MarkovCheckKsPassesBestOf10, MathewsCorrAdj, MathewsCorrArrow, Maximal, MaximalityCondition, McGetNumTestsH0, McGetNumTestsH1, NoAlmostCyclicPathsCondition, NoCyclicPathsCondition, NodesInCyclesPrecision, NodesInCyclesRecall, NonancestorPrecision, NonancestorRecall, NoPotentiallyDirectedF1, NoSemidirectedPrecision, NoSemidirectedRecall, NumAmbiguousTriples, NumberArrowsEst, NumberArrowsNotInUnshieldedCollidersEst, NumberCollidersEst, NumberEdgesEst, NumberEdgesInCollidersEst, NumberEdgesInUnshieldedCollidersEst, NumberEdgesTrue, NumberOfEdgesEst, NumberOfEdgesTrue, NumberTailsEst, NumberUnshieldedCollidersEst, NumBidirectedBothNonancestorAncestor, NumBidirectedEdgesEst, NumBidirectedEdgesTrue, NumColoredDD, NumColoredNL, NumColoredPD, NumColoredPL, NumCommonMeasuredAncestorBidirected, NumCompatibleDefiniteDirectedEdgeAncestors, NumCompatibleDirectedEdgeConfounded, NumCompatibleDirectedEdgeNonAncestors, NumCompatibleEdges, NumCompatiblePossiblyDirectedEdgeAncestors, NumCompatiblePossiblyDirectedEdgeNonAncestors, NumCompatiblePotentiallyDirectedEdgeAncestors, NumCompatiblePotentiallyDirectedEdgeNonAncestors, NumCompatibleVisibleNonancestors, NumCorrectBidirected, NumCorrectDDAncestors, NumCorrectPDAncestors, NumCorrectVisibleEdges, NumCoveringAdjacenciesInPag, NumDefinitelyDirected, NumDefinitelyNotDirectedPaths, NumDirectedEdgeAncestors, NumDirectedEdgeBnaMeasuredCounfounded, NumDirectedEdgeNoMeasureAncestors, NumDirectedEdgeNotAncNotRev, NumDirectedEdgeReversed, NumDirectedEdges, NumDirectedPathsEst, NumDirectedPathsTrue, NumDirectedShouldBePartiallyDirected, NumEdgeInEstInTrue, NumGenuineAdjacenciesInPag, NumIncorrectDDAncestors, NumIncorrectPDAncestors, NumIncorrectVisibleAncestors, NumLatentCommonAncestorBidirected, NumNondirectedEdges, NumParametersEst, NumPartiallyOrientedEdges, NumPotentiallyDirected, NumUndirectedEdges, NumVisibleEdges, NumVisibleEdgeTrue, OrientationPrecision, OrientationRecall, PagAdjacencyPrecision, PagAdjacencyRecall, ParameterColumn, PercentAmbiguous, PercentBidirectedEdges, ProportionSemidirectedPathsNotReversedEst, ProportionSemidirectedPathsNotReversedTrue, PvalueDistanceToAlpha, PvalueUniformityUnderNull, SemidirectedPathF1, SemidirectedPrecision, SemidirectedRecall, StructuralHammingDistance, TailPrecision, TailRecall, TrueDagFalseNegativesArrows, TrueDagFalseNegativesTails, TrueDagFalsePositiveArrow, TrueDagFalsePositiveTails, TrueDagPrecisionArrow, TrueDagPrecisionTails, TrueDagRecallArrows, TrueDagRecallTails, TrueDagTruePositiveArrow, TrueDagTruePositiveDirectedPathNonancestor, TrueDagTruePositiveTails, TwoCycleFalseNegative, TwoCycleFalsePositive, TwoCyclePrecision, TwoCycleRecall, TwoCycleTruePositive

public interface Statistic extends Serializable
The interface that each statistic needs to implement.
Version:
$Id: $Id
Author:
josephramsey
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Constant serialVersionUID=23L
  • Method Summary

    Modifier and Type
    Method
    Description
    static Graph
    alignNodes(Graph trueGraph, Graph estGraph)
    Returns the estimated graph with its nodes replaced, by name, with the true graph's node objects.
    The abbreviation for the statistic.
    Returns a short one-line description of this statistic.
    double
    getNormValue(double value)
    Returns a mapping of the statistic to the interval [0, 1], with higher being better.
    default double
    getValue(Graph trueGraph, Graph estGraph)
    Returns the value of this statistic, given the true graph and the estimated graph.
    default double
    getValue(Graph trueGraph, Graph estGraph, DataModel dataModel)
    Returns the value of this statistic, given the true graph and the estimated graph.
    default double
    getValue(Graph trueGraph, Graph estGraph, DataModel dataModel, Parameters parameters)
    Returns the value of this statistic, given the true graph and the estimated graph.
    double
    getValue(Graph trueDag, Graph trueGraph, Graph estGraph, DataModel dataModel, Parameters parameters)
    Calculates and returns the value of the statistic based on the provided graphs, data model, and parameters.
    default double
    getValue(Graph trueGraph, Graph estGraph, Parameters parameters)
    Returns the value of this statistic, given the true graph and the estimated graph.
    static Graph
    trueDagOrGraph(Graph trueDag, Graph trueGraph)
    Returns the graph a statistic should use for DAG-level questions--ancestry, latent confounding, or converting the truth to a CPDAG or PAG.
    default boolean
    Returns true if this statistics makes use of knowledge of the true graph.
  • Field Details

    • serialVersionUID

      static final long serialVersionUID
      Constant serialVersionUID=23L
      See Also:
  • Method Details

    • getAbbreviation

      String getAbbreviation()
      The abbreviation for the statistic. This will be printed at the top of each column.
      Returns:
      This abbreviation.
    • getDescription

      String getDescription()
      Returns a short one-line description of this statistic. This will be printed at the beginning of the report.
      Returns:
      This description.
    • getValue

      double getValue(Graph trueDag, Graph trueGraph, Graph estGraph, DataModel dataModel, Parameters parameters)
      Calculates and returns the value of the statistic based on the provided graphs, data model, and parameters.
      Parameters:
      trueDag - The true directed acyclic graph (DAG), including any latent and selection nodes, or null if no DAG is available. Statistics that ask DAG-level questions (ancestry, latent confounding, conversion to CPDAG or PAG) should read them off this graph, via trueDagOrGraph(Graph, Graph), not off trueGraph.
      trueGraph - The comparison graph, which could be a DAG, a CPDAG, or a PAG derived from the true DAG. Statistics that compare adjacencies or endpoints read them off this graph.
      estGraph - The estimated graph, which corresponds to the same type as the trueGraph.
      dataModel - The data model, which may be null.
      parameters - The parameters for the calculation, which may be null.
      Returns:
      The computed value of the statistic as a double.
    • trueDagOrGraph

      static Graph trueDagOrGraph(Graph trueDag, Graph trueGraph)
      Returns the graph a statistic should use for DAG-level questions--ancestry, latent confounding, or converting the truth to a CPDAG or PAG. This is the true DAG when the caller supplied one; otherwise it falls back to the comparison graph, which is all that callers of the four-argument getValue methods have. The fallback keeps the pre-existing behavior for those callers; when the comparison graph is itself a CPDAG or PAG, DAG-level questions asked of it are only approximate.
      Parameters:
      trueDag - The true DAG, or null if none was supplied.
      trueGraph - The comparison graph.
      Returns:
      trueDag if non-null, else trueGraph.
    • alignNodes

      static Graph alignNodes(Graph trueGraph, Graph estGraph)
      Returns the estimated graph with its nodes replaced, by name, with the true graph's node objects. Graph traversal in Tetrad compares nodes by identity, so a statistic handed an estimated graph over different node objects (an algorithm's output over data variables, say) would otherwise find no adjacencies or paths at all and report zeros without complaint. Comparison and CompareTwoGraphs align their graphs before calling the five-argument getValue; the four-argument defaults below do it here for everyone else.
      Parameters:
      trueGraph - The true graph; may be null, in which case estGraph is returned unchanged.
      estGraph - The estimated graph; may be null, in which case null is returned.
      Returns:
      The aligned estimated graph.
    • getValue

      default double getValue(Graph trueGraph, Graph estGraph, DataModel dataModel, Parameters parameters)
      Returns the value of this statistic, given the true graph and the estimated graph. The estimated graph is aligned to the true graph's node objects first; see alignNodes(Graph, Graph).
      Parameters:
      trueGraph - The true graph (DAG, CPDAG, PAG_of_the_true_DAG).
      estGraph - The estimated graph (same type).
      dataModel - The data model (can be null).
      parameters - The parameters (can be null).
      Returns:
      The value of the statistic.
    • getValue

      default double getValue(Graph trueGraph, Graph estGraph, DataModel dataModel)
      Returns the value of this statistic, given the true graph and the estimated graph.
      Parameters:
      trueGraph - The true graph (DAG, CPDAG, PAG_of_the_true_DAG).
      estGraph - The estimated graph (same type).
      dataModel - The data model (can be null).
      Returns:
      The value of the statistic.
    • getValue

      default double getValue(Graph trueGraph, Graph estGraph, Parameters parameters)
      Returns the value of this statistic, given the true graph and the estimated graph.
      Parameters:
      trueGraph - The true graph (DAG, CPDAG, PAG_of_the_true_DAG).
      estGraph - The estimated graph (same type).
      parameters - The parameters (can be null).
      Returns:
      The value of the statistic.
    • getValue

      default double getValue(Graph trueGraph, Graph estGraph)
      Returns the value of this statistic, given the true graph and the estimated graph.
      Parameters:
      trueGraph - The true graph (DAG, CPDAG, PAG_of_the_true_DAG).
      estGraph - The estimated graph (same type).
      Returns:
      The value of the statistic.
    • getNormValue

      double getNormValue(double value)
      Returns a mapping of the statistic to the interval [0, 1], with higher being better. This is used for a calculation of a utility for an algorithm. If the statistic is already between 0 and 1, you can just return the statistic.
      Parameters:
      value - The value of the statistic.
      Returns:
      The weight of the statistic, 0 to 1, higher is better.
    • usesTruth

      default boolean usesTruth()
      Returns true if this statistics makes use of knowledge of the true graph. When analyzing empirical data where the truth is not known, such statistic cannot be used, so we should hide it from the user so they don't accidentally select it (and get a bunch of NaN's in their results).
      Returns:
      True if this statistic uses the true graph, false otherwise.