Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.statcato.statistics.inferential
Class GoodnessOfFitTest

    java.lang.Object
      org.statcato.statistics.inferential.GoodnessOfFitTest

    public class GoodnessOfFitTest

extends java.lang.Object

A Chi-square goodness-of-fit test.

Since:
  1.0
Version:
  %I%, %G%
Author:
  Margaret Yau

Constructor Summary
`GoodnessOfFitTest(int k, double confidence)` Constructor.

Method Summary
`double` | `criticalValue()` Returns the critical value corresponding to the significance level and degrees of freedom.
`int` | `DOF()` Returns the degrees of freedom.
`double` | `pValue(double ts)` Returns the p-Value corresponding to the given test statistic in a chi-square distribution.
`double` | `testStatistic(java.util.Vector<java.lang.Double> observedFreq, java.util.Vector<java.lang.Double> expectedFreq)` Computes the chi-square test statistic for goodness-of-fit test in multinomial experiment, given the observed and expected frequencies.
`java.util.Vector<java.lang.Double>` | `testStatisticContribution(java.util.Vector<java.lang.Double> observedFreq, java.util.Vector<java.lang.Double> expectedFreq)` Returns a vector of each observed frequency's contribution to the chi-square test statistic.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GoodnessOfFitTest

    public GoodnessOfFitTest(int k,
                             double confidence)

  Constructor.

  Parameters:
    `k` - number of categories
    `confidence` - confidence level

Method Detail

### testStatisticContribution

    public java.util.Vector<java.lang.Double> testStatisticContribution(java.util.Vector<java.lang.Double> observedFreq,
                                                                        java.util.Vector<java.lang.Double> expectedFreq)

  Returns a vector of each observed frequency's contribution to the chi-square test statistic.

  Parameters:
    `observedFreq` - vector of observed frequencies
    `expectedFreq` - vector of expected frequencies
  Returns:
    a vector of Double (each observed frequency's contribution to test statistic)

### testStatistic

    public double testStatistic(java.util.Vector<java.lang.Double> observedFreq,
                                java.util.Vector<java.lang.Double> expectedFreq)

  Computes the chi-square test statistic for goodness-of-fit test in multinomial experiment, given the observed and expected frequencies. Chi^2 = Sum_{(O - E)^2 / E}.

  Parameters:
    `observedFreq` - a vector of observed frequencies
    `expectedFreq` - a vector of expected frequencies
  Returns:
    test statistic

### DOF

    public int DOF()

  Returns the degrees of freedom.

  Returns:
    degrees of freedom

### criticalValue

    public double criticalValue()

  Returns the critical value corresponding to the significance level and degrees of freedom.

  Returns:
    critical value

### pValue

    public double pValue(double ts)

  Returns the p-Value corresponding to the given test statistic in a chi-square distribution.

  Parameters:
    `ts` -
  Returns:
    p-value

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD