commons-statistics-regression/src/main/java/org/apache/commons/statistics/regression/stored/data_input/RegressionDataLoader.java
/**
     * Validates sample data. Checks that:
     * <ul>
     * <li>Neither x nor y is null or empty;</li>
     * <li>The length (i.e. number of rows) of x equals the length of y</li>
     * <li>x has at least one more row than it has columns (i.e. there is sufficient
     * data to estimate regression coefficients for each of the columns in x plus an
     * intercept.</li>
     * </ul>
     *
     * @param x the [n,k] array representing the x data
     * @param y the [n,1] array representing the y data
     * @throws IllegalArgumentException if {@code x} or {@code y} is null
     * @throws IllegalArgumentException if {@code x} and {@code y} do not have the
     *                                  same length
     * @throws IllegalArgumentException if {@code x} or {@code y} are zero-length
     * @throws IllegalArgumentException if the number of rows of {@code x} is not
     *                                  larger than the number of columns + 1
     */
Validates sample data. Checks that:

Neither x nor y is null or empty;
The length  of x equals the length of y
x has at least one more row than it has columns (i.e. there is sufficient
data to estimate regression coefficients for each of the columns in x plus an
intercept.



Validates sample data . Checks that : Neither x nor y is null or empty ; The length of x equals the length of y x has at least one more row than it has columns ( i . e . there is sufficient data to estimate regression coefficients for each of the columns in x plus an intercept .
protected void validateSampleData(double[] y, double[][] x) throws IllegalArgumentException {
        if ((x == null) || (y == null)) {
            throw new IllegalArgumentException("Null argument(s).");
        }
        if (x.length != y.length) {
            throw new IllegalArgumentException("Dimension mismatch: " + y.length + " != " + x.length);
        }
        if (x.length == 0) { 
            throw new IllegalArgumentException("Arrays have length 0.");
        }
        int numPredictors = x[0].length;
        int numObs = x.length;
        if (numPredictors > numObs) {
            throw new IllegalArgumentException(
                "Not enough data for number of predictors." + numPredictors + " > " + numObs);
        }
    }
protected void validateSampleData ( double [ ] y , double [ ] [ ] x ) throws IllegalArgumentException { if ( ( x == null ) || ( y == null ) ) { throw new IllegalArgumentException ( "Null argument(s)." ) ; } if ( x . length != y . length ) { throw new IllegalArgumentException ( "Dimension mismatch: " + y . length + " != " + x . length ) ; } if ( x . length == 0 ) { throw new IllegalArgumentException ( "Arrays have length 0." ) ; } int numPredictors = x [ 0 ] . length ; int numObs = x . length ; if ( numPredictors > numObs ) { throw new IllegalArgumentException ( "Not enough data for number of predictors." + numPredictors + " > " + numObs ) ; } }
Validates sample data.
Validates sample data .
// Must be no y data either