Author: celestin
Date: Thu May 24 19:23:37 2012
New Revision: 1342404
URL: http://svn.apache.org/viewvc?rev=1342404&view=rev
Log:
In o.a.c.m3.distribution.GammaDistribution
- deprecated getAlpha() and created getShape()
- deprecated getBeta() and created getScale().
See MATH-791.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java?rev=1342404&r1=1342403&r2=1342404&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java
Thu May 24 19:23:37 2012
@@ -36,7 +36,7 @@ public class GammaDistribution extends A
public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
/** Serializable version identifier. */
- private static final long serialVersionUID = 20120522L;
+ private static final long serialVersionUID = 20120524L;
/** The shape parameter. */
private final double shape;
@@ -104,7 +104,7 @@ public class GammaDistribution extends A
*
* @param shape the shape parameter
* @param scale the scale parameter
- * @param inverseCumAccuracy the aximum absolute error in inverse
+ * @param inverseCumAccuracy the maximum absolute error in inverse
* cumulative probability estimates (defaults to
* {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
* @throws NotStrictlyPositiveException if {@code shape <= 0} or
@@ -114,10 +114,10 @@ public class GammaDistribution extends A
public GammaDistribution(double shape, double scale, double
inverseCumAccuracy)
throws NotStrictlyPositiveException {
if (shape <= 0) {
- throw new NotStrictlyPositiveException(LocalizedFormats.ALPHA,
shape);
+ throw new NotStrictlyPositiveException(LocalizedFormats.SHAPE,
shape);
}
if (scale <= 0) {
- throw new NotStrictlyPositiveException(LocalizedFormats.BETA,
scale);
+ throw new NotStrictlyPositiveException(LocalizedFormats.SCALE,
scale);
}
this.shape = shape;
@@ -137,21 +137,43 @@ public class GammaDistribution extends A
* Returns the shape parameter of {@code this} distribution.
*
* @return the shape parameter
+ * @deprecated as of version 3.1, {@link #getShape()} should be preferred.
+ * This method will be removed in version 4.0.
*/
public double getAlpha() {
return shape;
}
/**
+ * Returns the shape parameter of {@code this} distribution.
+ *
+ * @return the shape parameter
+ */
+ public double getShape() {
+ return shape;
+ }
+
+ /**
* Returns the scale parameter of {@code this} distribution.
*
* @return the scale parameter
+ * @deprecated as of version 3.1, {@link #getScale()} should be preferred.
+ * This method will be removed in version 4.0.
*/
public double getBeta() {
return scale;
}
/**
+ * Returns the scale parameter of {@code this} distribution.
+ *
+ * @return the scale parameter
+ */
+ public double getScale() {
+ return scale;
+ }
+
+ /**
* {@inheritDoc}
*
* For this distribution {@code P(X = x)} always evaluates to 0.
@@ -262,7 +284,7 @@ public class GammaDistribution extends A
* mean is {@code alpha * beta}.
*/
public double getNumericalMean() {
- return getAlpha() * getBeta();
+ return shape * scale;
}
/**
@@ -274,8 +296,7 @@ public class GammaDistribution extends A
* @return {@inheritDoc}
*/
public double getNumericalVariance() {
- final double b = getBeta();
- return getAlpha() * b * b;
+ return shape * scale * scale;
}
/**