Skip to content

Commit

Permalink
Removed usage of non-localized error message. Changed exception type.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1292251 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Gilles Sadowski committed Feb 22, 2012
1 parent 7cc598e commit 64e0d5d
Showing 1 changed file with 21 additions and 21 deletions.
Expand Up @@ -20,6 +20,7 @@
import java.util.Arrays;
import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.MathArrays;
import org.apache.commons.math3.exception.OutOfRangeException;

/**
* Results of a Multiple Linear Regression model fit.
Expand Down Expand Up @@ -56,8 +57,6 @@ public class RegressionResults implements Serializable {
private final boolean containsConstant;
/** array storing global results, SSE, MSE, RSQ, adjRSQ */
private final double[] globalFitInfo;
/** error message */
private final String indexOutOfBound = "Index is outside of the 0 to number of variables - 1 range";

/**
* Set the default constructor to private access
Expand Down Expand Up @@ -143,16 +142,17 @@ public RegressionResults(
* <p>A redundant regressor will have its redundancy flag set, as well as
* a parameters estimated equal to {@code Double.NaN}</p>
*
* @param index an integer index which must be in the range [0, numberOfParameters-1]
* @return parameters estimated for regressor at index
* @throws IndexOutOfBoundsException thrown if the index >= numberOfParameters
* @param index Index.
* @return the parameters estimated for regressor at index.
* @throws OutOfRangeException if {@code index} is not in the interval
* {@code [0, number of parameters)}.
*/
public double getParameterEstimate(int index) throws IndexOutOfBoundsException {
public double getParameterEstimate(int index) {
if (parameters == null) {
return Double.NaN;
}
if (index < 0 || index >= this.parameters.length) {
throw new IndexOutOfBoundsException(indexOutOfBound);
throw new OutOfRangeException(index, 0, this.parameters.length - 1);
}
return this.parameters[index];
}
Expand All @@ -179,16 +179,17 @@ public double[] getParameterEstimates() {
* error of the parameter estimate at index</a>,
* usually denoted s(b<sub>index</sub>).
*
* @param index an integer index which must be in the range [0, numberOfParameters-1]
* @return standard errors associated with parameters estimated at index
* @throws IndexOutOfBoundsException thrown if the index >= numberOfParameters
* @param index Index.
* @return the standard errors associated with parameters estimated at index.
* @throws OutOfRangeException if {@code index} is not in the interval
* {@code [0, number of parameters)}.
*/
public double getStdErrorOfEstimate(int index) throws IndexOutOfBoundsException {
public double getStdErrorOfEstimate(int index) {
if (parameters == null) {
return Double.NaN;
}
if (index < 0 || index >= this.parameters.length) {
throw new IndexOutOfBoundsException(indexOutOfBound);
throw new OutOfRangeException(index, 0, this.parameters.length - 1);
}
double var = this.getVcvElement(index, index);
if (!Double.isNaN(var) && var > Double.MIN_VALUE) {
Expand Down Expand Up @@ -230,22 +231,21 @@ public double[] getStdErrorOfEstimates() {
* <p>If there are problems with an ill conditioned design matrix then the covariance
* which involves redundant columns will be assigned {@code Double.NaN}. </p>
*
* @param i - the ith regression parameter
* @param j - the jth regression parameter
* @return the covariance of the parameter estimates
* @throws IndexOutOfBoundsException thrown when i,j >= number of parameters
* @param i {@code i}th regression parameter.
* @param j {@code j}th regression parameter.
* @return the covariance of the parameter estimates.
* @throws OutOfRangeException if {@code i} or {@code j} is not in the
* interval {@code [0, number of parameters)}.
*/
public double getCovarianceOfParameters(int i, int j) throws IndexOutOfBoundsException {
public double getCovarianceOfParameters(int i, int j) {
if (parameters == null) {
return Double.NaN;
}
if (i < 0 || i >= this.parameters.length) {
throw new IndexOutOfBoundsException(" Row index is outside of the 0 " +
"to number of variables - 1 range");
throw new OutOfRangeException(i, 0, this.parameters.length - 1);
}
if (j < 0 || j >= this.parameters.length) {
throw new IndexOutOfBoundsException(" Column index is outside of the 0" +
" to number of variables - 1 range");
throw new OutOfRangeException(j, 0, this.parameters.length - 1);
}
return this.getVcvElement(i, j);
}
Expand Down

0 comments on commit 64e0d5d

Please sign in to comment.