Class PartialEdgeStrengthResult

java.lang.Object
edu.cmu.tetrad.sem.PartialEdgeStrengthResult
All Implemented Interfaces:
TetradSerializable, Serializable

public final class PartialEdgeStrengthResult extends Object implements TetradSerializable
Result of a partial edge strength computation performed by NNEstimator.computePartialEdgeStrength(String, String, int).

Partial edge strength asks: once Y's other parents are accounted for, does X add anything to held-out prediction of Y? It is computed on the same k folds as NNEstimator.crossValidate(int): on each fold the full model (all parents) and a reduced model (Y's mechanism retrained on the fold's training rows without X) both predict the held-out rows, and the difference in held-out score is reported.

  • Continuous child: partialR2 = R²_full − R²_reduced, with R² = 1 − OOS MSE / marginal variance, matching the Cross-Validation table. residualVariance holds the reduced model's held-out MSE.
  • Discrete child: partialXentImprovement = xent_reduced − xent_full in nats.

Positive means X carries information about Y that the other parents do not. Near zero means X is redundant given the other parents, which is not the same as X not being a cause; see EdgeStrengthResult for the complementary intervention measure, which stays large for a redundant parent the fitted mechanism actually uses.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final double
    Signed average marginal effect of the parent on the child: the average, over all held-out rows across the k folds, of the central finite difference (f(x + h) − f(x − h)) / (2h) of the fold's fitted mechanism with respect to the parent, with the other parents held at their observed values and h = 0.05 · SD(X).
    final double
    Standardized average marginal effect: avgMarginalEffect · SD(X) / SD(Y), with SDs taken from the observed data.
    final String
    Name of the child variable (head of the edge).
    final boolean
    true if the child variable is discrete.
    final double
    Fraction of held-out rows on which the local derivative was strictly positive, among rows with a finite derivative.
    final int
    Number of CV folds used.
    final String
    Name of the parent variable (tail of the edge).
    final double
    Held-out R² of the full model minus held-out R² of the model with X removed from Y's parents, on the same k folds as the CV table.
    final double
    OOS cross-entropy improvement of predicting R from X vs.
    final double
    Held-out MSE of the reduced model (Y predicted from its other parents, without X).
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    True if the fitted effect changed sign on more than 10% of held-out rows (minority side of fracPositiveDeriv above 0.10), so the average marginal effect mixes regions of opposite sign.
     
    Returns a human-readable one-line summary.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • parentName

      public final String parentName
      Name of the parent variable (tail of the edge).
    • childName

      public final String childName
      Name of the child variable (head of the edge).
    • discreteChild

      public final boolean discreteChild
      true if the child variable is discrete.
    • partialR2

      public final double partialR2
      Held-out R² of the full model minus held-out R² of the model with X removed from Y's parents, on the same k folds as the CV table. Positive = X adds predictive information beyond the other parents. NaN for discrete children.
    • residualVariance

      public final double residualVariance
      Held-out MSE of the reduced model (Y predicted from its other parents, without X). Kept under its original field name for session compatibility. NaN for discrete children.
    • partialXentImprovement

      public final double partialXentImprovement
      OOS cross-entropy improvement of predicting R from X vs. predicting the marginal residual distribution. For discrete children only. NaN for continuous children.
    • numFolds

      public final int numFolds
      Number of CV folds used.
    • avgMarginalEffect

      public final double avgMarginalEffect
      Signed average marginal effect of the parent on the child: the average, over all held-out rows across the k folds, of the central finite difference (f(x + h) − f(x − h)) / (2h) of the fold's fitted mechanism with respect to the parent, with the other parents held at their observed values and h = 0.05 · SD(X). Uses each fold's full model on that fold's held-out rows, so it is an out-of-sample quantity on the same folds as partialR2. On the parent's original scale (child units per parent unit). NaN unless both parent and child are continuous.
    • avgMarginalEffectStd

      public final double avgMarginalEffectStd
      Standardized average marginal effect: avgMarginalEffect · SD(X) / SD(Y), with SDs taken from the observed data. Unit-free, so magnitudes are comparable across parents. NaN unless both parent and child are continuous.
    • fracPositiveDeriv

      public final double fracPositiveDeriv
      Fraction of held-out rows on which the local derivative was strictly positive, among rows with a finite derivative. Values near 1 or 0 indicate a monotone fitted effect; intermediate values indicate the effect changes sign over the data range, in which case avgMarginalEffect is an average of opposing effects and should be read with care. NaN unless both parent and child are continuous.
  • Method Details

    • isNonMonotone

      public boolean isNonMonotone()
      True if the fitted effect changed sign on more than 10% of held-out rows (minority side of fracPositiveDeriv above 0.10), so the average marginal effect mixes regions of opposite sign.
      Returns:
      whether the fitted effect is flagged as non-monotone
    • toSummaryLine

      public String toSummaryLine()
      Returns a human-readable one-line summary.
      Returns:
      a human-readable one-line summary
    • toString

      public String toString()
      Overrides:
      toString in class Object