/** * {@inheritDoc} */ @Override public FourthMoment copy() { FourthMoment result = new FourthMoment(); copy(this, result); return result; }
/** * {@inheritDoc} */ public long getN() { return moment.getN(); }
/** * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#clear() */ public void clear() { if (incMoment) { moment.clear(); } else { throw new IllegalStateException ("Statistics constructed from external moments cannot be cleared"); } }
/** * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#increment(double) */ public void increment(final double d) { if (incMoment) { moment.increment(d); } else { throw new IllegalStateException ("Statistics constructed from external moments cannot be incremented"); } }
/** * Construct a Kurtosis */ public Kurtosis() { incMoment = true; moment = new FourthMoment(); }
/** * Copy constructor, creates a new {@code FourthMoment} identical * to the {@code original} * * @param original the {@code FourthMoment} instance to copy */ public FourthMoment(FourthMoment original) { super(); copy(original, this); }
/** * {@inheritDoc} */ @Override public void clear() { if (incMoment) { moment.clear(); } else { throw MathRuntimeException.createIllegalStateException( LocalizedFormats.CANNOT_CLEAR_STATISTIC_CONSTRUCTED_FROM_EXTERNAL_MOMENTS); } }
/** * {@inheritDoc} */ @Override public void increment(final double d) { if (incMoment) { moment.increment(d); } else { throw MathRuntimeException.createIllegalStateException( LocalizedFormats.CANNOT_INCREMENT_STATISTIC_CONSTRUCTED_FROM_EXTERNAL_MOMENTS); } }
/** * Construct a Kurtosis */ public Kurtosis() { incMoment = true; moment = new FourthMoment(); }
/** * Copy constructor, creates a new {@code FourthMoment} identical * to the {@code original} * * @param original the {@code FourthMoment} instance to copy */ public FourthMoment(FourthMoment original) { super(); copy(original, this); }
/** * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#getN() */ public long getN() { return moment.getN(); }
/** * {@inheritDoc} */ @Override public FourthMoment copy() { FourthMoment result = new FourthMoment(); copy(this, result); return result; }
/** * {@inheritDoc} */ @Override public void clear() { if (incMoment) { moment.clear(); } else { throw MathRuntimeException.createIllegalStateException( "statistics constructed from external moments cannot be cleared"); } }
/** * {@inheritDoc} */ @Override public void increment(final double d) { if (incMoment) { moment.increment(d); } else { throw MathRuntimeException.createIllegalStateException( "statistics constructed from external moments cannot be incremented"); } }
/** * Construct a Kurtosis */ public Kurtosis() { incMoment = true; moment = new FourthMoment(); }
/** * Copies source to dest. * <p>Neither source nor dest can be null.</p> * * @param source Kurtosis to copy * @param dest Kurtosis to copy to * @throws NullPointerException if either source or dest is null */ public static void copy(Kurtosis source, Kurtosis dest) { dest.moment = source.moment.copy(); dest.incMoment = source.incMoment; }
/** * {@inheritDoc} */ public long getN() { return moment.getN(); }
/** * Copies source to dest. * <p>Neither source nor dest can be null.</p> * * @param source Kurtosis to copy * @param dest Kurtosis to copy to * @throws NullPointerException if either source or dest is null */ public static void copy(Kurtosis source, Kurtosis dest) { dest.setData(source.getDataRef()); dest.moment = source.moment.copy(); dest.incMoment = source.incMoment; }
/** * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#getResult() */ public double getResult() { double kurtosis = Double.NaN; if (moment.getN() > 3) { double variance = moment.m2 / (double) (moment.n - 1); if (moment.n <= 3 || variance < 10E-20) { kurtosis = 0.0; } else { double n = (double) moment.n; kurtosis = (n * (n + 1) * moment.m4 - 3 * moment.m2 * moment.m2 * (n - 1)) / ((n - 1) * (n -2) * (n -3) * variance * variance); } } return kurtosis; }
/** * {@inheritDoc} */ @Override public double getResult() { double kurtosis = Double.NaN; if (moment.getN() > 3) { double variance = moment.m2 / (moment.n - 1); if (moment.n <= 3 || variance < 10E-20) { kurtosis = 0.0; } else { double n = moment.n; kurtosis = (n * (n + 1) * moment.m4 - 3 * moment.m2 * moment.m2 * (n - 1)) / ((n - 1) * (n -2) * (n -3) * variance * variance); } } return kurtosis; }