commons-statistics-regression/src/main/java/org/apache/commons/statistics/regression/stored/data_input/RegressionDataLoader.java
/**
     * <p>
     * Sets X data by creating a new StatisticsMatrix object from given array (see
     * {@code newXmatrix}).
     * </p>
     *
     * <p>
     * If {@code hasIntercept} is false then method will add the intercept column of
     * 1's. Method will also validate the data (see {@code validateSampleData})
     * </p>
     *
     * <p>
     * Note that previous Y sample data must be compatible or {@code null} if it's
     * initial input.
     * </p>
     *
     * @param x 2D double array
     */

Sets X data by creating a new StatisticsMatrix object from given array (see
newXmatrix).


If  hasIntercept is false then method will add the intercept column of
1's. Method will also validate the data



Note that previous Y sample data must be compatible or  null if it's
initial input.

@param x 2D double array
Sets X data by creating a new StatisticsMatrix object from given array ( see newXmatrix ) . If hasIntercept is false then method will add the intercept column of 1 ' s . Method will also validate the data Note that previous Y sample data must be compatible or null if it ' s initial input . @param x 2D double array
public void inputNewXSampleData(double[][] x) {
        if (x == null) {
            throw new IllegalArgumentException("Null x argument.");
        }
        if (inputData.getHasIntercept()) {
            inputData.setXData(createXmatrix(x));
        } else { 
            final int nVars = x[0].length;
            final double[][] xAug = new double[x.length][nVars + 1];
            for (int i = 0; i < x.length; i++) {
                if (x[i].length != nVars) {
                    throw new IllegalArgumentException(x[i].length + "!=" + nVars);
                }
                xAug[i][0] = 1.0d;
                System.arraycopy(x[i], 0, xAug[i], 1, nVars);
            }
            inputData.setXData(createXmatrix(xAug));
        }
        if (inputData.getY() != null) {
            validateSampleData(inputData.getY().toArray1D(), inputData.getX().toArray2D());
        }
    }
public void inputNewXSampleData ( double [ ] [ ] x ) { if ( x == null ) { throw new IllegalArgumentException ( "Null x argument." ) ; } if ( inputData . getHasIntercept ( ) ) { inputData . setXData ( createXmatrix ( x ) ) ; } else { final int nVars = x [ 0 ] . length ; final double [ ] [ ] xAug = new double [ x . length ] [ nVars + 1 ] ; for ( int i = 0 ; i < x . length ; i ++ ) { if ( x [ i ] . length != nVars ) { throw new IllegalArgumentException ( x [ i ] . length + "!=" + nVars ) ; } xAug [ i ] [ 0 ] = 1.0d ; System . arraycopy ( x [ i ] , 0 , xAug [ i ] , 1 , nVars ) ; } inputData . setXData ( createXmatrix ( xAug ) ) ; } if ( inputData . getY ( ) != null ) { validateSampleData ( inputData . getY ( ) . toArray1D ( ) , inputData . getX ( ) . toArray2D ( ) ) ; } }
<p>
 Sets X data by creating a new StatisticsMatrix object from given array (see
 {@code newXmatrix}).
<p > Sets X data by creating a new StatisticsMatrix object from given array ( see { @code newXmatrix } ) .
// Augment design matrix with initial unitary column