Class ChiSquareTest

java.lang.Object
edu.cmu.tetrad.search.ChiSquareTest
Direct Known Subclasses:
GSquareTest

public class ChiSquareTest extends Object
Calculates marginal chi square test results for a discrete dataset.
Author:
Frank Wimberly original version, Joseph Ramsey revision 10/01, believe it or now also 2020.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Simple class to store the parameters of the result returned by the G Square test.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChiSquareTest(DataSet dataSet, double alpha)
    Constructs a test using the given data set and significance level.
  • Method Summary

    Modifier and Type
    Method
    Description
    calcChiSquare(int[] testIndices)
    Calculates chi square for a conditional crosstabulation table for independence question 0 _||_ 1 | 2, 3, ...max by summing up chi square and degrees of freedom for each conditional table in turn, where rows or columns that consist entirely of zeros have been removed.
    double
     
     
     
    int[]
     
    boolean
    isDetermined(int[] testIndices, double p)
     
    int[]
    selectFromArray(int[] arr, int[] indices)
     
    void
    setAlpha(double alpha)
    Sets the significance level to be used for tests.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ChiSquareTest

      public ChiSquareTest(DataSet dataSet, double alpha)
      Constructs a test using the given data set and significance level.
      Parameters:
      dataSet - A data set consisting entirely of discrete variables.
      alpha - The significance level, usually 0.05.
  • Method Details

    • calcChiSquare

      public ChiSquareTest.Result calcChiSquare(int[] testIndices)
      Calculates chi square for a conditional crosstabulation table for independence question 0 _||_ 1 | 2, 3, ...max by summing up chi square and degrees of freedom for each conditional table in turn, where rows or columns that consist entirely of zeros have been removed.
    • isDetermined

      public boolean isDetermined(int[] testIndices, double p)
      Parameters:
      testIndices - An array of indices for variables in the dataset supplied in the constructor.
      p - The probability that some marginal for some table dominates. A good value is 0.99.
      Returns:
      True if the variable at index 0 is determined by the variables at the other indices.
    • getAlpha

      public double getAlpha()
      Returns:
      the getModel significance level being used for tests.
    • setAlpha

      public void setAlpha(double alpha)
      Sets the significance level to be used for tests.
    • selectFromArray

      public int[] selectFromArray(int[] arr, int[] indices)
    • getDataSet

      public DataSet getDataSet()
    • getDims

      public int[] getDims()
    • getCellTable

      public CellTable getCellTable()