Record Class MissingnessInjector.Mechanism

java.lang.Object
java.lang.Record
edu.cmu.tetrad.data.MissingnessInjector.Mechanism
Record Components:
valueEffects - Value effects (β). A term whose target equals its driver is self-masking.
indicatorEffects - Indicator effects (γ). These must not form a cycle, since a variable's indicators must be realized before they can drive another's deletion; a self-loop is a cycle.
attritionOrder - Columns that lose values by monotone attrition, in order, or null for none.
Enclosing class:
MissingnessInjector

public static record MissingnessInjector.Mechanism(List<MissingnessInjector.Effect> valueEffects, List<MissingnessInjector.Effect> indicatorEffects, int[] attritionOrder) extends Record
The terms of the deletion mechanism beyond the per-variable level and the row effect. Immutable; build one from none() with the with methods. Column indices are checked against the data when the mechanism is used, not when it is built. Weights for the same target and driver add.
Author:
josephramsey
  • Constructor Details

  • Method Details

    • none

      public static MissingnessInjector.Mechanism none()
      The empty mechanism: no value effects, no indicator effects, no attrition. With it the injector is MCAR.
      Returns:
      The empty mechanism.
    • withValueEffect

      public MissingnessInjector.Mechanism withValueEffect(int target, int driver, double weight)
      Adds a value effect: the standardized true value of driver shifts the log odds that target is deleted. With target == driver this is self-masking.
      Parameters:
      target - The target column.
      driver - The driver column.
      weight - The coefficient on the logit scale.
      Returns:
      A new mechanism with the term added.
    • withSelfMasking

      public MissingnessInjector.Mechanism withSelfMasking(int target, double weight)
      Adds self-masking: the variable's own true value shifts the log odds that it is deleted. A negative weight deletes low values preferentially.
      Parameters:
      target - The column.
      weight - The coefficient on the logit scale.
      Returns:
      A new mechanism with the term added.
    • withIndicatorEffect

      public MissingnessInjector.Mechanism withIndicatorEffect(int target, int driver, double weight)
      Adds an indicator effect: whether driver was deleted in a case shifts the log odds that target is deleted in that case.
      Parameters:
      target - The target column.
      driver - The driver column.
      weight - The coefficient on the logit scale.
      Returns:
      A new mechanism with the term added.
    • withAttrition

      public MissingnessInjector.Mechanism withAttrition(int... order)
      Sets the attrition order. Variables in it lose values monotonically along it, with the per-variable rates read as cumulative dropout rates, which must therefore be nondecreasing along the order. Value effects whose target is in the order act on the dropout hazard at that step. Indicator effects may not target a variable in the order.
      Parameters:
      order - Column indices, distinct, earliest first.
      Returns:
      A new mechanism with this attrition order.
    • attritionOrder

      public int[] attritionOrder()
      Returns a copy of the attrition order, or null.
      Returns:
      The attrition order.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • valueEffects

      public List<MissingnessInjector.Effect> valueEffects()
      Returns the value of the valueEffects record component.
      Returns:
      the value of the valueEffects record component
    • indicatorEffects

      public List<MissingnessInjector.Effect> indicatorEffects()
      Returns the value of the indicatorEffects record component.
      Returns:
      the value of the indicatorEffects record component