/** * {@inheritDoc} * <p><strong>Note: </strong>This implementation rescales the * <code>expected</code> array if necessary to ensure that the sum of the * expected and observed counts are equal.</p> * * @param observed array of observed frequency counts * @param expected array of expected frequency counts * @return p-value * @throws IllegalArgumentException if preconditions are not met * @throws MathException if an error occurs computing the p-value */ public double chiSquareTest(double[] expected, long[] observed) throws IllegalArgumentException, MathException { distribution.setDegreesOfFreedom(expected.length - 1.0); return 1.0 - distribution.cumulativeProbability( chiSquare(expected, observed)); }
try { pValue = cs.chiSquareTest(expected, observed); chiSq = cs.chiSquare(expected, observed); } catch (Exception e) { e.printStackTrace();
try { pValues.addValue(cs.chiSquareTest(expected, observed)); xs.addValue(cs.chiSquare(expected, observed)); } catch (Exception e) { e.printStackTrace();
/** * {@inheritDoc} * <p><strong>Note: </strong>This implementation rescales the * <code>expected</code> array if necessary to ensure that the sum of the * expected and observed counts are equal.</p> * * @param observed array of observed frequency counts * @param expected array of expected frequency counts * @return p-value * @throws IllegalArgumentException if preconditions are not met * @throws MathException if an error occurs computing the p-value */ public double chiSquareTest(double[] expected, long[] observed) throws IllegalArgumentException, MathException { distribution.setDegreesOfFreedom(expected.length - 1.0); return 1.0 - distribution.cumulativeProbability( chiSquare(expected, observed)); }
/** * {@inheritDoc} * <p><strong>Note: </strong>This implementation rescales the * <code>expected</code> array if necessary to ensure that the sum of the * expected and observed counts are equal.</p> * * @param observed array of observed frequency counts * @param expected array of expected frequency counts * @return p-value * @throws IllegalArgumentException if preconditions are not met * @throws MathException if an error occurs computing the p-value */ public double chiSquareTest(double[] expected, long[] observed) throws IllegalArgumentException, MathException { distribution.setDegreesOfFreedom(expected.length - 1.0); return 1.0 - distribution.cumulativeProbability( chiSquare(expected, observed)); }
/** * @param counts array representation of 2-way table * @return p-value * @throws IllegalArgumentException if preconditions are not met * @throws MathException if an error occurs computing the p-value */ public double chiSquareTest(long[][] counts) throws IllegalArgumentException, MathException { checkArray(counts); double df = ((double) counts.length -1) * ((double) counts[0].length - 1); distribution.setDegreesOfFreedom(df); return 1 - distribution.cumulativeProbability(chiSquare(counts)); }
public IValue chiSquare(IList dataValues){ makeChi(dataValues); return values.real(new ChiSquareTestImpl().chiSquare(expected, observed)); }
/** * @param counts array representation of 2-way table * @return p-value * @throws IllegalArgumentException if preconditions are not met * @throws MathException if an error occurs computing the p-value */ public double chiSquareTest(long[][] counts) throws IllegalArgumentException, MathException { checkArray(counts); double df = ((double) counts.length -1) * ((double) counts[0].length - 1); distribution.setDegreesOfFreedom(df); return 1 - distribution.cumulativeProbability(chiSquare(counts)); }
/** * @param counts array representation of 2-way table * @return p-value * @throws IllegalArgumentException if preconditions are not met * @throws MathException if an error occurs computing the p-value */ public double chiSquareTest(long[][] counts) throws IllegalArgumentException, MathException { checkArray(counts); double df = ((double) counts.length -1) * ((double) counts[0].length - 1); distribution.setDegreesOfFreedom(df); return 1 - distribution.cumulativeProbability(chiSquare(counts)); }