This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-statistics.git
commit 35036c2e1dda9b990ff2804e35607ba4b5e62c88 Author: Alex Herbert <[email protected]> AuthorDate: Mon Dec 20 22:22:30 2021 +0000 Javadoc mean and variance using abstract methods --- .../statistics/distribution/TDistribution.java | 55 +++++++++++----------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TDistribution.java b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TDistribution.java index c7143d5..0ce37a1 100644 --- a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TDistribution.java +++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TDistribution.java @@ -151,20 +151,17 @@ public abstract class TDistribution extends AbstractContinuousDistribution { } } - /** {@inheritDoc} */ @Override public double density(double x) { return Math.exp(logDensity(x)); } - /** {@inheritDoc} */ @Override public double logDensity(double x) { final double nPlus1Over2 = dofOver2 + 0.5; return factor - nPlus1Over2 * Math.log1p(x * x / getDegreesOfFreedom()); } - /** {@inheritDoc} */ @Override public double cumulativeProbability(double x) { if (x == 0) { @@ -202,40 +199,16 @@ public abstract class TDistribution extends AbstractContinuousDistribution { 1 - 0.5 * p; } - /** - * {@inheritDoc} - * - * <p>For degrees of freedom parameter {@code df}, the mean is - * <ul> - * <li>zero if {@code df > 1}, and</li> - * <li>undefined ({@code NaN}) otherwise.</li> - * </ul> - * - * @return the mean, or {@code NaN} if it is not defined. - */ @Override public double getMean() { return mean; } - /** - * {@inheritDoc} - * - * <p>For degrees of freedom parameter {@code df}, the variance is - * <ul> - * <li>{@code df / (df - 2)} if {@code df > 2},</li> - * <li>positive infinity if {@code 1 < df <= 2}, and</li> - * <li>undefined ({@code NaN}) otherwise.</li> - * </ul> - * - * @return the mean, or {@code NaN} if it is not defined. - */ @Override public double getVariance() { return variance; } - /** {@inheritDoc} */ @Override double getMedian() { // Overridden for the probability(double, double) method. @@ -294,6 +267,34 @@ public abstract class TDistribution extends AbstractContinuousDistribution { // Exploit symmetry return -inverseCumulativeProbability(p); } + /** + * {@inheritDoc} + * + * <p>For degrees of freedom parameter {@code df}, the mean is + * <ul> + * <li>zero if {@code df > 1}, and</li> + * <li>undefined ({@code NaN}) otherwise.</li> + * </ul> + * + * @return the mean, or {@code NaN} if it is not defined. + */ + @Override + public abstract double getMean(); + + /** + * {@inheritDoc} + * + * <p>For degrees of freedom parameter {@code df}, the variance is + * <ul> + * <li>{@code df / (df - 2)} if {@code df > 2},</li> + * <li>positive infinity if {@code 1 < df <= 2}, and</li> + * <li>undefined ({@code NaN}) otherwise.</li> + * </ul> + * + * @return the variance, or {@code NaN} if it is not defined. + */ + @Override + public abstract double getVariance(); /** * {@inheritDoc}
