/** * {@inheritDoc} */ @Override public FourthMoment copy() { FourthMoment result = new FourthMoment(); // No try-catch or advertised exception because args are guaranteed non-null copy(this, result); return result; }
/** * {@inheritDoc} */ @Override public void clear() { if (incMoment) { moment.clear(); } }
/** * {@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.getResult() - 3 * moment.m2 * moment.m2 * (n - 1)) / ((n - 1) * (n -2) * (n -3) * variance * variance); } } return kurtosis; }
/** * Copy constructor, creates a new {@code FourthMoment} identical * to the {@code original} * * @param original the {@code FourthMoment} instance to copy * @throws NullArgumentException if original is null */ FourthMoment(FourthMoment original) throws NullArgumentException { super(); copy(original, this); }
/** * {@inheritDoc} */ public long getN() { return moment.getN(); }
/** * Construct a Kurtosis */ public Kurtosis() { incMoment = true; moment = new FourthMoment(); }
/** * {@inheritDoc} * <p>Note that when {@link #Kurtosis(FourthMoment)} is used to * create a Variance, this method does nothing. In that case, the * FourthMoment should be incremented directly.</p> */ @Override public void increment(final double d) { if (incMoment) { moment.increment(d); } }
/** * 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 NullArgumentException if either source or dest is null */ public static void copy(Kurtosis source, Kurtosis dest) throws NullArgumentException { MathUtils.checkNotNull(source); MathUtils.checkNotNull(dest); dest.setData(source.getDataRef()); dest.moment = source.moment.copy(); dest.incMoment = source.incMoment; }
/** * {@inheritDoc} */ public long getN() { return moment.getN(); }
/** * Construct a Kurtosis */ public Kurtosis() { incMoment = true; moment = new FourthMoment(); }
/** * {@inheritDoc} * <p>Note that when {@link #Kurtosis(FourthMoment)} is used to * create a Variance, this method does nothing. In that case, the * FourthMoment should be incremented directly.</p> */ @Override public void increment(final double d) { if (incMoment) { moment.increment(d); } }
/** * {@inheritDoc} */ @Override public FourthMoment copy() { FourthMoment result = new FourthMoment(); // No try-catch or advertised exception because args are guaranteed non-null copy(this, result); return result; }
/** * {@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.getResult() - 3 * moment.m2 * moment.m2 * (n - 1)) / ((n - 1) * (n -2) * (n -3) * variance * variance); } } return kurtosis; }
/** * Copy constructor, creates a new {@code FourthMoment} identical * to the {@code original} * * @param original the {@code FourthMoment} instance to copy * @throws NullArgumentException if original is null */ FourthMoment(FourthMoment original) throws NullArgumentException { super(); copy(original, this); }
/** * {@inheritDoc} */ public long getN() { return moment.getN(); }
/** * {@inheritDoc} */ @Override public void clear() { if (incMoment) { moment.clear(); } }
/** * Construct a Kurtosis */ public Kurtosis() { incMoment = true; moment = new FourthMoment(); }
/** * {@inheritDoc} * <p>Note that when {@link #Kurtosis(FourthMoment)} is used to * create a Variance, this method does nothing. In that case, the * FourthMoment should be incremented directly.</p> */ @Override public void increment(final double d) { if (incMoment) { moment.increment(d); } }
/** * {@inheritDoc} */ @Override public FourthMoment copy() { FourthMoment result = new FourthMoment(); // No try-catch or advertised exception because args are guaranteed non-null copy(this, result); return result; }
/** * {@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.getResult() - 3 * moment.m2 * moment.m2 * (n - 1)) / ((n - 1) * (n -2) * (n -3) * variance * variance); } } return kurtosis; }