Class MixedModelEdgeCasesTest

java.lang.Object
ubic.gemma.core.util.math.linearmodels.MixedModelEdgeCasesTest

public class MixedModelEdgeCasesTest extends Object
Situations the golden fixtures do not reach: clamping, missing observations, weights, permutation, and the small-sample gates of MixedModelFit.estimateCorrelation(DoubleMatrix2D, String[], DoubleMatrix2D, DoubleMatrix2D). Synthetic data, seeded.
  • Constructor Details

    • MixedModelEdgeCasesTest

      public MixedModelEdgeCasesTest()
  • Method Details

    • nearPerfectDuplicatesClampAtTheUpperBound

      @Test public void nearPerfectDuplicatesClampAtTheUpperBound()
      Subject variance dwarfs the noise: the per-probe rho sits at its upper clamp (0.99) rather than at 1, where the correlation matrix would no longer be positive definite.
    • anticorrelatedPairsGoNegativeButStayAboveTheLowerBound

      @Test public void anticorrelatedPairsGoNegativeButStayAboveTheLowerBound()
      Mirror-image pairs: the estimate is bounded below by 1/(1 - maxBlockSize) + 0.01 = -0.99 for blocks of two, so it can be negative but never singular.
    • noSubjectVarianceGivesACorrelationNearZero

      @Test public void noSubjectVarianceGivesACorrelationNearZero()
      No subject structure in the data: the consensus is small and either sign, and nothing degenerates.
    • probesWithMissingValuesAreEstimatedOrSkippedNotFatal

      @Test public void probesWithMissingValuesAreEstimatedOrSkippedNotFatal()
      A probe with a missing observation is estimated on its observed samples (limma's per-probe subsetting); a probe with so little left that it fails the gate keeps NaN and is left out of the consensus.
    • allProbesTooSparseGivesZeroWithoutTheDegenerateFlag

      @Test public void allProbesTooSparseGivesZeroWithoutTheDegenerateFlag()
      If every probe fails the per-probe gate there is no consensus; Gemma reports rho = 0 (the fit becomes OLS) rather than NaN, and does not flag the back-off as degenerate-by-design.
    • unitWeightsGiveTheUnweightedEstimate

      @Test public void unitWeightsGiveTheUnweightedEstimate()
      Uniform weights of one change nothing.
    • estimateIsInvariantToSampleOrder

      @Test public void estimateIsInvariantToSampleOrder()
      Reordering samples (design, block and data columns together) does not change the estimate, so a block's members need not be adjacent. This also covers a block id that recurs in separate groups of columns, which limma treats as one block.
    • correlationMatrixIsBlockDiagonalWithUnitDiagonal

      @Test public void correlationMatrixIsBlockDiagonalWithUnitDiagonal()
      Blocks of different sizes: the lower clamp follows the LARGEST block (1/(1 - 4) + 0.01), and the correlation matrix is block-diagonal with unit diagonal.
    • tooFewSamplesForTheDesignGivesZero

      @Test public void tooFewSamplesForTheDesignGivesZero()
      Fewer samples than the per-probe gate allows (nobs <= nbeta + 2): nothing estimable, rho = 0.