commons-statistics-regression/src/main/java/org/apache/commons/statistics/regression/stored/ols/OLSRegression.java
/**
     * Calculates the regression coefficients using OLS.
     *
     * <p>
     * Data for the model must have been successfully loaded using one of the
     * {@code inputNewSampleData} methods before invoking this method; otherwise a
     * {@code NullPointerException} will be thrown.
     * </p>
     *
     * @return beta
     */
Calculates the regression coefficients using OLS.

Data for the model must have been successfully loaded using one of the
inputNewSampleData methods before invoking this method; otherwise a
NullPointerException will be thrown.

@return beta
Calculates the regression coefficients using OLS . Data for the model must have been successfully loaded using one of the inputNewSampleData methods before invoking this method ; otherwise a NullPointerException will be thrown . @return beta
@Override
    protected StatisticsMatrix calculateBeta() {
        LinearSolverDense<DMatrixRMaj> solver = LinearSolverFactory_DDRM.leastSquares(getX().numRows(),
            getX().numCols());
        solver = new LinearSolverSafe<DMatrixRMaj>(solver);
        StatisticsMatrix betas = new StatisticsMatrix(new DMatrixRMaj(getX().numCols()));
        solver.setA(getX().getDDRM().copy());
        solver.solve(getY().getDDRM(), betas.getDDRM());
        return betas;
    }
@ Override protected StatisticsMatrix calculateBeta ( ) { LinearSolverDense < DMatrixRMaj > solver = LinearSolverFactory_DDRM . leastSquares ( getX ( ) . numRows ( ) , getX ( ) . numCols ( ) ) ; solver = new LinearSolverSafe < DMatrixRMaj > ( solver ) ; StatisticsMatrix betas = new StatisticsMatrix ( new DMatrixRMaj ( getX ( ) . numCols ( ) ) ) ; solver . setA ( getX ( ) . getDDRM ( ) . copy ( ) ) ; solver . solve ( getY ( ) . getDDRM ( ) , betas . getDDRM ( ) ) ; return betas ; }
Calculates the regression coefficients using OLS.
Calculates the regression coefficients using OLS .