org.statcato.statistics.inferential
Class GoodnessOfFitTest
- java.lang.Object
-
- org.statcato.statistics.inferential.GoodnessOfFitTest
-
public class GoodnessOfFitTest extends java.lang.ObjectA Chi-square goodness-of-fit test.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor and Description GoodnessOfFitTest(int k, double confidence)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecriticalValue()Returns the critical value corresponding to the significance level and degrees of freedom.intDOF()Returns the degrees of freedom.doublepValue(double ts)Returns the p-Value corresponding to the given test statistic in a chi-square distribution.doubletestStatistic(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.
-
-
-
Constructor Detail
-
GoodnessOfFitTest
public GoodnessOfFitTest(int k, double confidence)Constructor.- Parameters:
k- number of categoriesconfidence- 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 frequenciesexpectedFreq- 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 frequenciesexpectedFreq- 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
-
-
DMelt 3.0 © DataMelt by jWork.ORG