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 Summary
ConstructorsConstructorDescriptionMechanism(List<MissingnessInjector.Effect> valueEffects, List<MissingnessInjector.Effect> indicatorEffects, int[] attritionOrder) Canonical constructor, making defensive copies. -
Method Summary
Modifier and TypeMethodDescriptionint[]Returns a copy of the attrition order, or null.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theindicatorEffectsrecord component.none()The empty mechanism: no value effects, no indicator effects, no attrition.final StringtoString()Returns a string representation of this record class.Returns the value of thevalueEffectsrecord component.withAttrition(int... order) Sets the attrition order.withIndicatorEffect(int target, int driver, double weight) Adds an indicator effect: whetherdriverwas deleted in a case shifts the log odds thattargetis deleted in that case.withSelfMasking(int target, double weight) Adds self-masking: the variable's own true value shifts the log odds that it is deleted.withValueEffect(int target, int driver, double weight) Adds a value effect: the standardized true value ofdrivershifts the log odds thattargetis deleted.
-
Constructor Details
-
Mechanism
public Mechanism(List<MissingnessInjector.Effect> valueEffects, List<MissingnessInjector.Effect> indicatorEffects, int[] attritionOrder) Canonical constructor, making defensive copies.
-
-
Method Details
-
none
The empty mechanism: no value effects, no indicator effects, no attrition. With it the injector is MCAR.- Returns:
- The empty mechanism.
-
withValueEffect
Adds a value effect: the standardized true value ofdrivershifts the log odds thattargetis deleted. Withtarget == driverthis 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
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
Adds an indicator effect: whetherdriverwas deleted in a case shifts the log odds thattargetis 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
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
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
valueEffects
Returns the value of thevalueEffectsrecord component.- Returns:
- the value of the
valueEffectsrecord component
-
indicatorEffects
Returns the value of theindicatorEffectsrecord component.- Returns:
- the value of the
indicatorEffectsrecord component
-