Package org.apache.commons.math3.exception

Examples of org.apache.commons.math3.exception.NoDataException


        }

        final int n = xval.length;

        if (n == 0) {
            throw new NoDataException();
        }

        checkAllFiniteReal(xval);
        checkAllFiniteReal(yval);
        checkAllFiniteReal(weights);
View Full Code Here


            throw new NullArgumentException();
        }

        if ( xval.length == 0 || yval.length == 0 || fval.length == 0 )
        {
            throw new NoDataException();
        }

        MathArrays.checkOrder(xval);
        MathArrays.checkOrder(yval);
View Full Code Here

        int n = sample1.length;
        if (n != sample2.length) {
            throw new DimensionMismatchException(n, sample2.length);
        }
        if (n <= 0) {
            throw new NoDataException(LocalizedFormats.INSUFFICIENT_DIMENSION);
        }
        double result = 0;
        for (int i = 0; i < n; i++) {
            result += sample1[i] - sample2[i];
        }
View Full Code Here

                                                           final double[] zval,
                                                           final double[][][] fval)
        throws NoDataException, NumberIsTooSmallException,
               DimensionMismatchException, NonMonotonicSequenceException {
        if (xval.length == 0 || yval.length == 0 || zval.length == 0 || fval.length == 0) {
            throw new NoDataException();
        }
        if (xval.length != fval.length) {
            throw new DimensionMismatchException(xval.length, fval.length);
        }
View Full Code Here

     * @exception NoDataException if interpolation cannot be performed
     * because sample is empty
     */
    private void checkInterpolation() throws NoDataException {
        if (abscissae.isEmpty()) {
            throw new NoDataException(LocalizedFormats.EMPTY_INTERPOLATION_SAMPLE);
        }
    }
View Full Code Here

    protected void newYSampleData(double[] y) {
        if (y == null) {
            throw new NullArgumentException();
        }
        if (y.length == 0) {
            throw new NoDataException();
        }
        this.yVector = new ArrayRealVector(y);
    }
View Full Code Here

    protected void newXSampleData(double[][] x) {
        if (x == null) {
            throw new NullArgumentException();
        }
        if (x.length == 0) {
            throw new NoDataException();
        }
        if (noIntercept) {
            this.xMatrix = new Array2DRowRealMatrix(x, true);
        } else { // Augment design matrix with initial unitary column
            final int nVars = x[0].length;
View Full Code Here

        }
        if (x.length != y.length) {
            throw new DimensionMismatchException(y.length, x.length);
        }
        if (x.length == 0) {  // Must be no y data either
            throw new NoDataException();
        }
        if (x[0].length + 1 > x.length) {
            throw new MathIllegalArgumentException(
                    LocalizedFormats.NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS,
                    x.length, x[0].length);
View Full Code Here

                                                          final double[] yval,
                                                          final double[][] fval)
        throws NoDataException, NullArgumentException,
               DimensionMismatchException, NonMonotonicSequenceException {
        if (xval.length == 0 || yval.length == 0 || fval.length == 0) {
            throw new NoDataException();
        }
        if (xval.length != fval.length) {
            throw new DimensionMismatchException(xval.length, fval.length);
        }
View Full Code Here

     * estimate the regression parameters
     */
    public RegressionResults regress() throws ModelSpecificationException, NoDataException {
        if (hasIntercept) {
          if( n < 3 ){
              throw new NoDataException(LocalizedFormats.NOT_ENOUGH_DATA_REGRESSION);
          }
          if( FastMath.abs( sumXX ) > Precision.SAFE_MIN ){
              final double[] params = new double[]{ getIntercept(), getSlope() };
              final double mse = getMeanSquareError();
              final double _syy = sumYY + sumY * sumY / n;
              final double[] vcv = new double[]{
                mse * (xbar *xbar /sumXX + 1.0 / n),
                -xbar*mse/sumXX,
                mse/sumXX };
              return new RegressionResults(
                      params, new double[][]{vcv}, true, n, 2,
                      sumY, _syy, getSumSquaredErrors(),true,false);
          }else{
              final double[] params = new double[]{ sumY / n, Double.NaN };
              //final double mse = getMeanSquareError();
              final double[] vcv = new double[]{
                ybar / (n - 1.0),
                Double.NaN,
                Double.NaN };
              return new RegressionResults(
                      params, new double[][]{vcv}, true, n, 1,
                      sumY, sumYY, getSumSquaredErrors(),true,false);
          }
        }else{
          if (n < 2) {
              throw new NoDataException(LocalizedFormats.NOT_ENOUGH_DATA_REGRESSION);
          }
          if( !Double.isNaN(sumXX) ){
          final double[] vcv = new double[]{ getMeanSquareError() / sumXX };
          final double[] params = new double[]{ sumXY/sumXX };
          return new RegressionResults(
View Full Code Here

TOP

Related Classes of org.apache.commons.math3.exception.NoDataException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.