Class TestDataAudit
java.lang.Object
edu.cmu.tetrad.test.TestDataAudit
Tests the pre-search data audit. Each test plants one pathology in simulated data and asserts that the
corresponding finding fires; the clean-data test asserts that no warnings fire on well-behaved Gaussian data. All
simulations use fixed seeds.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidA column with no non-missing values at all should fire CONSTANT_COLUMN with numNonMissing = 0.voidClean Gaussian data should produce zero WARNING findings.voidA near-copy pair should fire HIGH_CORRELATION and NEAR_DETERMINISM_LINEAR but not EXACT_LINEAR_DEPENDENCE.voidAn exactly constant continuous column, a continuous column constant on its two non-missing entries, and a single-category discrete column should each fire CONSTANT_COLUMN (and not NEAR_CONSTANT); a varying Gaussian column should fire neither.voidA constant column must not mask downstream findings among the remaining variables: with a constant X1 present, a near-linear-dependence among X2, X3, X4 should still fire NEAR_DETERMINISM_LINEAR, the continuous-name accessors should exclude X1, and the correlation matrix should cover only the non-constant variables.voidAn exact linear copy should fire EXACT_LINEAR_DEPENDENCE.voidThe JSON rendering should contain the expected top-level keys and have balanced braces.voidn = 30 with p = 10 should fire LOW_SAMPLE_RATIO.voidA 13-level discrete variable should fire DISCRETE_MANY_LEVELS, and a continuous variable taking three values should fire CONTINUOUS_FEW_VALUES.voidMCAR-injected missingness should produce exactly one MISSING_DATA finding, a non-null delegated MissingDataAudit, and a Little's MCAR p-value among the finding's values.voidA negligible-variance (but varying) continuous column and a 99.5-percent-modal (but two-category) discrete column should each fire NEAR_CONSTANT, and neither should fire CONSTANT_COLUMN.voidA class variable with well-separated class means nearly determining a continuous variable should fire NEAR_DETERMINISM_DISCRETE_CONTINUOUS.voidAn AR(1) series with substantial lag-1 autocorrelation should fire SERIAL_DEPENDENCE with the AR(1) effective-sample-size clause in the message and without the periodicSuspect flag.voidA periodic series with near-zero lag-1 autocorrelation but a dominant autocorrelation at a deeper lag (here a period-4 cycle, whose lag-2 autocorrelation is near -1 while lag-1 is near 0) should fire SERIAL_DEPENDENCE with the periodic-dependence clause in place of the AR(1) effective-sample-size clause, and should carry periodicSuspect = 1 in its values.voidA lognormal column should fire NON_GAUSSIAN at severity INFO; a Gaussian column should not fire.voidA discrete variable with a 3-case category should fire SMALL_MARGINAL_CELL.voidTwo 5-level discrete variables at n = 100 should fire SMALL_PAIRWISE_CELLS.
-
Constructor Details
-
TestDataAudit
public TestDataAudit()Constructs a new test.
-
-
Method Details
-
testCleanGaussianNoWarnings
public void testCleanGaussianNoWarnings()Clean Gaussian data should produce zero WARNING findings. -
testCollinearPair
public void testCollinearPair()A near-copy pair should fire HIGH_CORRELATION and NEAR_DETERMINISM_LINEAR but not EXACT_LINEAR_DEPENDENCE. -
testExactLinearDependence
public void testExactLinearDependence()An exact linear copy should fire EXACT_LINEAR_DEPENDENCE. -
testSkewedColumn
public void testSkewedColumn()A lognormal column should fire NON_GAUSSIAN at severity INFO; a Gaussian column should not fire. -
testSmallMarginalCell
public void testSmallMarginalCell()A discrete variable with a 3-case category should fire SMALL_MARGINAL_CELL. -
testSmallPairwiseCells
public void testSmallPairwiseCells()Two 5-level discrete variables at n = 100 should fire SMALL_PAIRWISE_CELLS. -
testNearDeterminismDiscreteContinuous
public void testNearDeterminismDiscreteContinuous()A class variable with well-separated class means nearly determining a continuous variable should fire NEAR_DETERMINISM_DISCRETE_CONTINUOUS. -
testNearConstant
public void testNearConstant()A negligible-variance (but varying) continuous column and a 99.5-percent-modal (but two-category) discrete column should each fire NEAR_CONSTANT, and neither should fire CONSTANT_COLUMN. -
testConstantColumn
public void testConstantColumn()An exactly constant continuous column, a continuous column constant on its two non-missing entries, and a single-category discrete column should each fire CONSTANT_COLUMN (and not NEAR_CONSTANT); a varying Gaussian column should fire neither. -
testAllMissingColumn
public void testAllMissingColumn()A column with no non-missing values at all should fire CONSTANT_COLUMN with numNonMissing = 0. -
testConstantColumnDoesNotMaskDownstreamChecks
public void testConstantColumnDoesNotMaskDownstreamChecks()A constant column must not mask downstream findings among the remaining variables: with a constant X1 present, a near-linear-dependence among X2, X3, X4 should still fire NEAR_DETERMINISM_LINEAR, the continuous-name accessors should exclude X1, and the correlation matrix should cover only the non-constant variables. (Before constant columns were excluded, X1's undefined correlations aborted the whole correlation battery.) -
testManyLevelsAndFewValues
public void testManyLevelsAndFewValues()A 13-level discrete variable should fire DISCRETE_MANY_LEVELS, and a continuous variable taking three values should fire CONTINUOUS_FEW_VALUES. -
testLowSampleRatio
public void testLowSampleRatio()n = 30 with p = 10 should fire LOW_SAMPLE_RATIO. -
testMissingData
public void testMissingData()MCAR-injected missingness should produce exactly one MISSING_DATA finding, a non-null delegated MissingDataAudit, and a Little's MCAR p-value among the finding's values. -
testJsonWellFormed
public void testJsonWellFormed()The JSON rendering should contain the expected top-level keys and have balanced braces. -
testSerialDependenceAr1Message
public void testSerialDependenceAr1Message()An AR(1) series with substantial lag-1 autocorrelation should fire SERIAL_DEPENDENCE with the AR(1) effective-sample-size clause in the message and without the periodicSuspect flag. -
testSerialDependencePeriodicSuspectMessage
public void testSerialDependencePeriodicSuspectMessage()A periodic series with near-zero lag-1 autocorrelation but a dominant autocorrelation at a deeper lag (here a period-4 cycle, whose lag-2 autocorrelation is near -1 while lag-1 is near 0) should fire SERIAL_DEPENDENCE with the periodic-dependence clause in place of the AR(1) effective-sample-size clause, and should carry periodicSuspect = 1 in its values. This is the thinned task-fMRI case: AR decay removed by thinning, but a stimulus-locked cycle remaining at the task period.
-