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
The injection specification.
- Author:
- josephramsey
-
Constructor Summary
ConstructorsConstructorDescriptionSpec(double[] rates, double rowPropensity) Canonical constructor, validating the rates and the row effect. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.double[]rates()Returns a copy of the rates, so the array cannot be mutated through the record.doubleReturns the value of therowPropensityrecord component.final StringtoString()Returns a string representation of this record class.static MissingnessInjector.Specuniform(int numVars, double rate, double rowPropensity) A uniform-rate spec, reproducing the historical constant-rate behavior.
-
Constructor Details
-
Spec
public Spec(double[] rates, double rowPropensity) Canonical constructor, validating the rates and the row effect.
-
-
Method Details
-
uniform
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
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
rowPropensity
public double rowPropensity()Returns the value of therowPropensityrecord component.- Returns:
- the value of the
rowPropensityrecord component
-