Class EquivalenceTest

java.lang.Object
edu.cmu.tetrad.algcomparison.independence.EquivalenceTest
All Implemented Interfaces:
IndependenceWrapper, HasParameters, TetradSerializable, Serializable

@TestOfIndependence(name="Equivalence (TOST)", command="equivalence-test", dataType={Continuous,Covariance}) @LinearGaussian public class EquivalenceTest extends Object implements IndependenceWrapper
Wrapper for the equivalence (TOST) test on the Fisher Z partial correlation.

Reports independence only when it can show the partial correlation is negligible, instead of when it fails to reject zero. An adjacency search deletes an edge on a report of independence, so with an ordinary test it deletes on the absence of evidence; the removal region |z| < c*se shrinks with the sample size, which means weak-but-real edges are deleted most eagerly at exactly the sample sizes where deleting them is least justified. Choosing this test moves the burden of proof onto removal.

Two caveats before selecting it. The margin must exceed roughly 1.645/sqrt(n) at alpha = 0.05 or nothing is removable and the search returns a complete graph, which is why Params.EQUIVALENCE_MARGIN defaults to 0, meaning "scale the margin to the sample size". And the test's meaning of independence is weaker than an ordinary test's meaning of dependence, so an algorithm that asks "are these two dependent?" inside an orientation rule may be degraded by it. For CCD, prefer Params.USE_EQUIVALENCE_REMOVAL on the algorithm, which applies the equivalence rule to the adjacency phase alone and leaves orientation on the selected test.

Author:
josephramsey
See Also:
  • Constructor Details

    • EquivalenceTest

      public EquivalenceTest()
      Constructs a new instance of the test.
  • Method Details

    • getTest

      public IndependenceTest getTest(DataModel dataModel, Parameters parameters)
      Builds the equivalence test for the given data and parameters. When Params.EQUIVALENCE_MARGIN is 0 the margin is scaled to the sample size, as Params.EQUIVALENCE_MARGIN_MULTIPLIER times the smallest margin that sample size could certify.
      Specified by:
      getTest in interface IndependenceWrapper
      Parameters:
      dataModel - the data set or covariance matrix to test independence against.
      parameters - the parameters of the test.
      Returns:
      the equivalence test.
      Throws:
      IllegalArgumentException - if the data model is neither a data set nor a covariance matrix, or the sample size is too small to be usable.
    • build

      public static IndTestEquivalence build(IndTestFisherZ fisherZ, int sampleSize, double margin, double multiplier, double alpha)
      Builds the equivalence test from an already-constructed Fisher Z test, resolving the margin the same way getTest(DataModel, Parameters) does. Exposed so that an algorithm applying the equivalence rule to one phase only can reuse the resolution logic.
      Parameters:
      fisherZ - the underlying Fisher Z test.
      sampleSize - the sample size the margin is scaled to when margin is 0.
      margin - the explicit margin, or 0 to scale it to the sample size.
      multiplier - the multiplier used when margin is 0.
      alpha - the one-sided level of each of the two tests.
      Returns:
      the equivalence test.
      Throws:
      IllegalArgumentException - if the sample size is too small for the automatic margin.
    • getDescription

      public String getDescription()
      Returns a short description of this test.
      Specified by:
      getDescription in interface IndependenceWrapper
      Returns:
      the description.
    • getDataType

      public DataType getDataType()
      Returns the data type this test requires.
      Specified by:
      getDataType in interface IndependenceWrapper
      Returns:
      continuous data.
    • getParameters

      public List<String> getParameters()
      Returns the parameters this test uses.
      Specified by:
      getParameters in interface HasParameters
      Specified by:
      getParameters in interface IndependenceWrapper
      Returns:
      the parameter names.