Record Class MissingnessInjector.Spec

java.lang.Object
java.lang.Record
edu.cmu.tetrad.data.MissingnessInjector.Spec
Record Components:
rates - Target marginal missingness rate per variable, in dataset column order, each in [0, 1]. A rate of exactly 0 leaves the variable untouched; a rate of exactly 1 blanks it entirely.
rowPropensity - The latent row effect λ, at least 0. Zero gives independent deletion. Around 1.0 produces roughly twice the spread in per-case missing counts that independence would give, which is the magnitude seen in real attrition data.
Enclosing class:
MissingnessInjector

public static record MissingnessInjector.Spec(double[] rates, double rowPropensity) extends Record
The injection specification.
Author:
josephramsey
  • Constructor Summary

    Constructors
    Constructor
    Description
    Spec(double[] rates, double rowPropensity)
    Canonical constructor, validating the rates and the row effect.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double[]
    Returns a copy of the rates, so the array cannot be mutated through the record.
    double
    Returns the value of the rowPropensity record component.
    final String
    Returns a string representation of this record class.
    uniform(int numVars, double rate, double rowPropensity)
    A uniform-rate spec, reproducing the historical constant-rate behavior.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Spec

      public Spec(double[] rates, double rowPropensity)
      Canonical constructor, validating the rates and the row effect.
  • Method Details

    • uniform

      public static MissingnessInjector.Spec uniform(int numVars, double rate, double rowPropensity)
      A uniform-rate spec, reproducing the historical constant-rate behavior.
      Parameters:
      numVars - Number of variables.
      rate - The rate to apply to every variable.
      rowPropensity - The latent row effect.
      Returns:
      The spec.
    • rates

      public double[] rates()
      Returns a copy of the rates, so the array cannot be mutated through the record.
      Returns:
      The rates.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • rowPropensity

      public double rowPropensity()
      Returns the value of the rowPropensity record component.
      Returns:
      the value of the rowPropensity record component