Example usage for java.lang Double isNaN

List of usage examples for java.lang Double isNaN

Introduction

In this page you can find the example usage for java.lang Double isNaN.

Prototype

public static boolean isNaN(double v) 

Source Link

Document

Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

Usage

From source file:com.joptimizer.optimizers.NewtonLEConstrainedFSP.java

@Override
public int optimize() throws Exception {
    Log.d(MainActivity.JOPTIMIZER_LOGTAG, "optimize");
    OptimizationResponse response = new OptimizationResponse();

    //checking responsibility
    if (getFi() != null) {
        // forward to the chain
        return forwardOptimizationRequest();
    }//from  w w w .jav a 2 s .c  o  m

    long tStart = System.currentTimeMillis();

    //initial point must be feasible (i.e., satisfy x in domF and Ax = b).
    DoubleMatrix1D X0 = getInitialPoint();
    double rPriX0Norm = (X0 != null) ? Math.sqrt(ALG.norm2(rPri(X0))) : 0d;
    //if (X0 == null   || (getA()!=null && Double.compare(ALG.norm2(getA().zMult(X0, getB().copy(), 1., -1., false)), 0d) != 0)) {
    //if (X0 == null   || rPriX0Norm > Utils.getDoubleMachineEpsilon()) {   
    if (X0 == null || rPriX0Norm > getTolerance()) {
        // infeasible starting point, forward to the chain
        return forwardOptimizationRequest();
    }

    if (Log.isLoggable(MainActivity.JOPTIMIZER_LOGTAG, Log.DEBUG)) {
        Log.d(MainActivity.JOPTIMIZER_LOGTAG, "X0:  " + ArrayUtils.toString(X0.toArray()));
    }
    DoubleMatrix1D X = X0;
    double F0X;
    //double previousF0X = Double.NaN;
    double previousLambda = Double.NaN;
    int iteration = 0;
    while (true) {
        iteration++;
        F0X = getF0(X);
        if (Log.isLoggable(MainActivity.JOPTIMIZER_LOGTAG, Log.DEBUG)) {
            Log.d(MainActivity.JOPTIMIZER_LOGTAG, "iteration " + iteration);
            Log.d(MainActivity.JOPTIMIZER_LOGTAG, "X=" + ArrayUtils.toString(X.toArray()));
            Log.d(MainActivity.JOPTIMIZER_LOGTAG, "f(X)=" + F0X);
        }

        //         if(!Double.isNaN(previousF0X)){
        //            if (previousF0X < F0X) {
        //               throw new Exception("critical minimization problem");
        //            }
        //         }
        //         previousF0X = F0X;

        // custom exit condition
        if (checkCustomExitConditions(X)) {
            response.setReturnCode(OptimizationResponse.SUCCESS);
            break;
        }

        DoubleMatrix1D gradX = getGradF0(X);
        DoubleMatrix2D hessX = getHessF0(X);

        double gradXNorm = Math.sqrt(ALG.norm2(gradX));
        if (gradXNorm < Utils.getDoubleMachineEpsilon()) {
            response.setReturnCode(OptimizationResponse.SUCCESS);
            break;
        }

        // Newton step and decrement
        if (this.kktSolver == null) {
            this.kktSolver = new BasicKKTSolver();
        }
        if (isCheckKKTSolutionAccuracy()) {
            kktSolver.setCheckKKTSolutionAccuracy(isCheckKKTSolutionAccuracy());
            kktSolver.setToleranceKKT(getToleranceKKT());
        }
        kktSolver.setHMatrix(hessX.toArray());
        kktSolver.setGVector(gradX.toArray());
        if (getA() != null) {
            kktSolver.setAMatrix(getA().toArray());
            kktSolver.setATMatrix(getAT().toArray());
        }
        double[][] sol = kktSolver.solve();
        DoubleMatrix1D step = F1.make(sol[0]);
        DoubleMatrix1D w = (sol[1] != null) ? F1.make(sol[1]) : F1.make(0);
        if (Log.isLoggable(MainActivity.JOPTIMIZER_LOGTAG, Log.DEBUG)) {
            Log.d(MainActivity.JOPTIMIZER_LOGTAG, "stepX: " + ArrayUtils.toString(step.toArray()));
            Log.d(MainActivity.JOPTIMIZER_LOGTAG, "w    : " + ArrayUtils.toString(w.toArray()));
        }

        // exit condition: check the Newton decrement
        double lambda = Math.sqrt(ALG.mult(step, ALG.mult(hessX, step)));
        Log.d(MainActivity.JOPTIMIZER_LOGTAG, "lambda: " + lambda);
        if (lambda / 2. <= getTolerance()) {
            response.setReturnCode(OptimizationResponse.SUCCESS);
            break;
        }

        // iteration limit condition
        if (iteration == getMaxIteration()) {
            response.setReturnCode(OptimizationResponse.WARN);
            Log.w(MainActivity.JOPTIMIZER_LOGTAG, "Max iterations limit reached");
            break;
        }

        // progress conditions
        if (isCheckProgressConditions()) {
            if (!Double.isNaN(previousLambda) && previousLambda <= lambda) {
                Log.w(MainActivity.JOPTIMIZER_LOGTAG,
                        "No progress achieved, exit iterations loop without desired accuracy");
                response.setReturnCode(OptimizationResponse.WARN);
                break;
            }
        }
        previousLambda = lambda;

        // backtracking line search
        double s = 1d;
        DoubleMatrix1D X1 = null;
        int cnt = 0;
        while (cnt < 250) {
            cnt++;
            // @TODO: can we use simplification 9.7.1 ??
            X1 = X.copy().assign(step.copy().assign(Mult.mult(s)), Functions.plus);// x + t*step
            //Log.d(MainActivity.JOPTIMIZER_LOGTAG,"X1: "+ArrayUtils.toString(X1.toArray()));

            if (isInDomainF0(X1)) {
                double condSX = getF0(X1);
                //NB: this will also check !Double.isNaN(getF0(X1))
                double condDX = F0X + getAlpha() * s * ALG.mult(gradX, step);
                //Log.d(MainActivity.JOPTIMIZER_LOGTAG,"condSX: "+condSX);
                //Log.d(MainActivity.JOPTIMIZER_LOGTAG,"condDX: "+condDX);
                if (condSX <= condDX) {
                    break;
                }
            }
            s = getBeta() * s;
        }
        Log.d(MainActivity.JOPTIMIZER_LOGTAG, "s: " + s);

        // update
        X = X1;
    }

    long tStop = System.currentTimeMillis();
    Log.d(MainActivity.JOPTIMIZER_LOGTAG, "time: " + (tStop - tStart));
    response.setSolution(X.toArray());
    setOptimizationResponse(response);
    return response.getReturnCode();
}

From source file:com.projity.server.data.mspdi.ModifiedMSPDIWriter.java

/**
 * This method writes data for a single task to an MSPDI file.
 *
 * @param factory//from www .  j av  a  2  s . c o  m
 *            ObjectFactory instance
 * @param mpx
 *            Task data
 * @return new task instance
 * @throws JAXBException
 *             on xml creation errors
 */
protected Project.TasksType.TaskType writeTask(ObjectFactory factory, Task mpx) throws JAXBException {

    /* DEF167859:  Projity: MS Project Export not working
       mpxj doesn't handle NaN.  this would be better fixed in mpxj code itself in the DatatypeConverter, but
       it would be a pain to setup the development environment to build this... so we will hack this for now
       --TAF2009-07-29
     */
    if (Double.isNaN(mpx.getFixedCost().doubleValue()))
        mpx.setFixedCost(null);

    Project.TasksType.TaskType xml = super.writeTask(factory, mpx);
    if (!mpx.getNull())
        writeTaskBaselinesAndTimephased(factory, xml, mpx);
    return xml;
}

From source file:geogebra.kernel.AlgoIntegralDefinite.java

private static double doAdaptiveGaussQuad(RealRootFunction fun, double a, double b) {
    if (++adaptiveGaussQuadCounter > MAX_GAUSS_QUAD_CALLS) {
        return Double.NaN;
    }/*from   w w w. ja v a  2 s .  co  m*/

    // init GaussQuad classes for numerical integration
    if (firstGauss == null) {
        firstGauss = new LegendreGaussIntegrator(FIRST_ORDER, MAX_ITER);
        secondGauss = new LegendreGaussIntegrator(SECOND_ORDER, MAX_ITER);
    }

    double firstSum = 0;
    double secondSum = 0;

    boolean error = false;

    // integrate using gauss quadrature
    try {
        firstSum = firstGauss.integrate(new RealRootAdapter(fun), a, b);
        if (Double.isNaN(firstSum))
            return Double.NaN;
        secondSum = secondGauss.integrate(new RealRootAdapter(fun), a, b);
        if (Double.isNaN(secondSum))
            return Double.NaN;
    } catch (MaxIterationsExceededException e) {
        error = true;
    } catch (ConvergenceException e) {
        error = true;
    } catch (FunctionEvaluationException e) {
        return Double.NaN;
    } catch (IllegalArgumentException e) {
        return Double.NaN;
    }

    //if (!error) Application.debug(a+" "+b+" "+(firstSum - secondSum), Kernel.isEqual(firstSum, secondSum, Kernel.STANDARD_PRECISION) ? 1 : 0);
    //else Application.debug(a+" "+b+" error",1);

    // check if both results are equal
    boolean equal = !error && Kernel.isEqual(firstSum, secondSum, Kernel.STANDARD_PRECISION);

    if (equal) {
        // success              
        return secondSum;
    } else {
        double mid = (a + b) / 2;
        double left = doAdaptiveGaussQuad(fun, a, mid);
        if (Double.isNaN(left))
            return Double.NaN;
        else
            return left + doAdaptiveGaussQuad(fun, mid, b);
    }
}

From source file:com.joptimizer.util.MPSParser.java

public MPSParser(double unspecifiedLBValue, double unspecifiedUBValue, double unboundedLBValue,
        double unboundedUBValue) {
    if (!Double.isNaN(unboundedLBValue) && !Double.isInfinite(unboundedLBValue)) {
        throw new IllegalArgumentException(
                "The field unboundedLBValue must be set to Double.NaN or Double.NEGATIVE_INFINITY");
    }//from  w ww  .  j a v  a 2s.  c  o  m
    if (!Double.isNaN(unboundedUBValue) && !Double.isInfinite(unboundedUBValue)) {
        throw new IllegalArgumentException(
                "The field unboundedUBValue must be set to Double.NaN or Double.POSITIVE_INFINITY");
    }
    this.unspecifiedLBValue = unspecifiedLBValue;
    this.unspecifiedUBValue = unspecifiedUBValue;
    this.unboundedLBValue = unboundedLBValue;
    this.unboundedUBValue = unboundedUBValue;
}

From source file:com.opengamma.analytics.financial.model.volatility.BlackFormulaRepository.java

/**
 * The forward (i.e. driftless) delta/*from w w  w  .j  a v  a 2s .c  o  m*/
 * @param forward The forward value of the underlying
 * @param strike The Strike
 * @param timeToExpiry The time-to-expiry
 * @param lognormalVol The log-normal volatility
 * @param isCall true for call
 * @return The forward delta
 */
@ExternalFunction
public static double delta(final double forward, final double strike, final double timeToExpiry,
        final double lognormalVol, final boolean isCall) {
    ArgumentChecker.isTrue(forward >= 0.0, "negative/NaN forward; have {}", forward);
    ArgumentChecker.isTrue(strike >= 0.0, "negative/NaN strike; have {}", strike);
    ArgumentChecker.isTrue(timeToExpiry >= 0.0, "negative/NaN timeToExpiry; have {}", timeToExpiry);
    ArgumentChecker.isTrue(lognormalVol >= 0.0, "negative/NaN lognormalVol; have {}", lognormalVol);

    double sigmaRootT = lognormalVol * Math.sqrt(timeToExpiry);
    if (Double.isNaN(sigmaRootT)) {
        s_logger.info("lognormalVol * Math.sqrt(timeToExpiry) ambiguous");
        sigmaRootT = 1.;
    }
    final int sign = isCall ? 1 : -1;

    double d1 = 0.;
    final boolean bFwd = (forward > LARGE);
    final boolean bStr = (strike > LARGE);
    final boolean bSigRt = (sigmaRootT > LARGE);

    if (bSigRt) {
        return isCall ? 1. : 0.;
    }
    if (sigmaRootT < SMALL) {
        if (Math.abs(forward - strike) >= SMALL && !(bFwd && bStr)) {
            return (isCall ? (forward > strike ? 1.0 : 0.0) : (forward > strike ? 0.0 : -1.0));
        }
        s_logger.info("(log 1.)/0., ambiguous value");
        return isCall ? 0.5 : -0.5;
    }
    if (Math.abs(forward - strike) < SMALL | (bFwd && bStr)) {
        d1 = 0.5 * sigmaRootT;
    } else {
        d1 = Math.log(forward / strike) / sigmaRootT + 0.5 * sigmaRootT;
    }

    return sign * NORMAL.getCDF(sign * d1);
}

From source file:com.rapidminer.gui.plotter.DistributionPlotter.java

public void paintComponent(Graphics graphics, int width, int height) {
    preparePlots();/* w  ww  .  j  a  v a2s  .com*/
    if (plot) {
        JFreeChart chart = null;
        try {
            if (!Double.isNaN(model.getUpperBound(plotColumn))) {
                chart = createNumericalChart();
            } else {
                chart = createNominalChart();
            }
        } catch (Exception e) {
            // do nothing - just do not draw the chart
        }

        if (chart != null) {
            // set the background color for the chart...
            chart.setBackgroundPaint(Color.white);

            // legend settings
            LegendTitle legend = chart.getLegend();
            if (legend != null) {
                legend.setPosition(RectangleEdge.TOP);
                legend.setFrame(BlockBorder.NONE);
                legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
            }
            Rectangle2D drawRect = new Rectangle2D.Double(0, 0, width, height);
            chart.draw((Graphics2D) graphics, drawRect);
        }
    }
}

From source file:de.laures.cewolf.jfree.XYSplineRenderer.java

/**
 * Draws the item (first pass). This method draws the lines
 * connecting the items. Instead of drawing separate lines,
 * a GeneralPath is constructed and drawn at the end of the series painting.
 *
 * @param g2  the graphics device./*  w w w.  ja  v a2s. c o m*/
 * @param state  the renderer state.
 * @param plot  the plot (can be used to obtain standard color information etc).
 * @param dataset  the dataset.
 * @param pass  the pass.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataArea  the area within which the data is being drawn.
 */
protected void drawPrimaryLineAsPath(XYItemRendererState state, Graphics2D g2, XYPlot plot, XYDataset dataset,
        int pass, int series, int item, ValueAxis domainAxis, ValueAxis rangeAxis, Rectangle2D dataArea) {

    RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
    RectangleEdge yAxisLocation = plot.getRangeAxisEdge();

    // get the data points
    double x1 = dataset.getXValue(series, item);
    double y1 = dataset.getYValue(series, item);
    double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation);
    double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation);

    // collect points
    if (!Double.isNaN(transX1) && !Double.isNaN(transY1)) {
        ControlPoint p = new ControlPoint(
                plot.getOrientation() == PlotOrientation.HORIZONTAL ? (float) transY1 : (float) transX1,
                plot.getOrientation() == PlotOrientation.HORIZONTAL ? (float) transX1 : (float) transY1);
        if (!this.points.contains(p)) {
            this.points.add(p);
        }
    }
    if (item == dataset.getItemCount(series) - 1) {
        State s = (State) state;
        // construct path
        if (this.points.size() > 1) {
            // we need at least two points to draw something
            ControlPoint cp0 = (ControlPoint) this.points.get(0);
            s.seriesPath.moveTo(cp0.x, cp0.y);
            if (this.points.size() == 2) {
                // we need at least 3 points to spline. Draw simple line for two points
                ControlPoint cp1 = (ControlPoint) this.points.get(1);
                s.seriesPath.lineTo(cp1.x, cp1.y);
            } else {
                // construct spline
                int np = this.points.size(); // number of points
                float[] d = new float[np]; // Newton form coefficients
                float[] x = new float[np]; // x-coordinates of nodes
                float y;
                float t;
                float[] a = new float[np];
                float t1;
                float t2;
                float[] h = new float[np];

                for (int i = 0; i < np; i++) {
                    ControlPoint cpi = (ControlPoint) this.points.get(i);
                    x[i] = cpi.x;
                    d[i] = cpi.y;
                }

                for (int i = 1; i <= np - 1; i++) {
                    h[i] = x[i] - x[i - 1];
                }
                float[] sub = new float[np - 1];
                float[] diag = new float[np - 1];
                float[] sup = new float[np - 1];

                for (int i = 1; i <= np - 2; i++) {
                    diag[i] = (h[i] + h[i + 1]) / 3;
                    sup[i] = h[i + 1] / 6;
                    sub[i] = h[i] / 6;
                    a[i] = (d[i + 1] - d[i]) / h[i + 1] - (d[i] - d[i - 1]) / h[i];
                }
                solveTridiag(sub, diag, sup, a, np - 2);

                // note that a[0]=a[np-1]=0
                // draw
                s.seriesPath.moveTo(x[0], d[0]);
                for (int i = 1; i <= np - 1; i++) {
                    // loop over intervals between nodes
                    for (int j = 1; j <= this.precision; j++) {
                        t1 = (h[i] * j) / this.precision;
                        t2 = h[i] - t1;
                        y = ((-a[i - 1] / 6 * (t2 + h[i]) * t1 + d[i - 1]) * t2
                                + (-a[i] / 6 * (t1 + h[i]) * t2 + d[i]) * t1) / h[i];
                        t = x[i - 1] + t1;
                        s.seriesPath.lineTo(t, y);
                    }
                }
            }
            // draw path
            drawFirstPassShape(g2, pass, series, item, s.seriesPath);
        }

        // reset points vector
        this.points = new Vector();
    }
}

From source file:net.librec.recommender.FactorizationMachineRecommender.java

/**
 * recommend// www . ja v  a 2 s.co  m
 * * predict the ratings in the test data
 *
 * @return predictive rating matrix
 * @throws LibrecException
 */
protected RecommendedList recommendRating() throws LibrecException {
    testMatrix = testTensor.rateMatrix();
    recommendedList = new RecommendedItemList(numUsers - 1, numUsers);

    // each user-item pair appears in the final recommend list only once
    Table<Integer, Integer, Double> ratingMapping = HashBasedTable.create();

    for (TensorEntry tensorEntry : testTensor) {
        int[] entryKeys = tensorEntry.keys();
        SparseVector featureVector = tenserKeysToFeatureVector(entryKeys);
        double predictRating = predict(featureVector, true);
        if (Double.isNaN(predictRating)) {
            predictRating = globalMean;
        }
        int[] userItemInd = getUserItemIndex(featureVector);
        int userIdx = userItemInd[0];
        int itemIdx = userItemInd[1];
        if (!ratingMapping.contains(userIdx, itemIdx)) {
            ratingMapping.put(userIdx, itemIdx, predictRating);
            recommendedList.addUserItemIdx(userIdx, itemIdx, predictRating);
        }
    }

    return recommendedList;
}

From source file:edu.cudenver.bios.chartsvc.resource.LegendResource.java

private XYPlot buildScatterPlot(Chart chart) throws ResourceException {
    // the first series is treated as the x values
    if (chart.getSeries() == null || chart.getSeries().size() <= 0)
        throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "No data series specified");

    // create the jfree chart series
    XYSeriesCollection chartData = new XYSeriesCollection();
    // use a spline renderer to make the connecting lines smooth
    XYSplineRenderer rend = new XYSplineRenderer();

    int seriesIdx = 0;
    for (Series series : chart.getSeries()) {
        XYSeries xySeries = new XYSeries(series.getLabel());

        List<Double> xList = series.getXCoordinates();
        List<Double> yList = series.getYCoordinates();
        if (xList != null && yList != null && xList.size() == yList.size()) {
            for (int i = 0; i < xList.size(); i++) {
                xySeries.add(xList.get(i), yList.get(i));
            }//from  www.j a v  a  2  s. c  o m
        }

        // set the line style
        rend.setSeriesPaint(seriesIdx, Color.BLACK);
        if (seriesIdx > 0) {
            rend.setSeriesStroke(seriesIdx, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
                    1.0f, new float[] { (float) seriesIdx, (float) 2 * seriesIdx }, 0.0f));
        }
        // add the series to the data set
        chartData.addSeries(xySeries);
        seriesIdx++;
    }

    // turn off shapes displayed at each data point to make a smooth curve
    rend.setBaseShapesVisible(false);

    // Create the line chart
    NumberAxis xAxis = new NumberAxis();
    xAxis.setAutoRangeIncludesZero(false);
    if (chart.getXAxis() != null) {
        Axis xAxisSpec = chart.getXAxis();
        xAxis.setLabel(xAxisSpec.getLabel());
        if (!Double.isNaN(xAxisSpec.getRangeMin()) && !Double.isNaN(xAxisSpec.getRangeMax())) {
            xAxis.setRange(xAxisSpec.getRangeMin(), xAxisSpec.getRangeMax());
        }
    }
    NumberAxis yAxis = new NumberAxis();
    if (chart.getYAxis() != null) {
        Axis yAxisSpec = chart.getYAxis();
        yAxis.setLabel(chart.getYAxis().getLabel());
        if (!Double.isNaN(yAxisSpec.getRangeMin()) && !Double.isNaN(yAxisSpec.getRangeMax())) {
            xAxis.setRange(yAxisSpec.getRangeMin(), yAxisSpec.getRangeMax());
        }
    }
    XYPlot plot = new XYPlot((XYDataset) chartData, xAxis, yAxis, rend);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);

    return plot;
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.DRResultsController.java

/**
 * Create the table model for the top panel table. Table contains for both
 * the initial and normalized fitting: the best-fit values, R, standard
 * errors and 95% CI.//from   w  ww  .  j a  v  a2 s . c  o  m
 *
 * @param analysisGroup
 * @return the model
 */
protected NonEditableTableModel createTableModel(DoseResponseAnalysisGroup analysisGroup) {
    DoseResponseAnalysisResults analysisResults = analysisGroup.getDoseResponseAnalysisResults();
    //specify decimal format for scientific notation
    DecimalFormat df = new DecimalFormat("00.00E00");
    Object[][] data = new Object[18][3];

    //set fields in first column
    data[0][0] = "Best-fit value";
    data[1][0] = "    Bottom";
    data[2][0] = "    Top";
    data[3][0] = "    Hillslope";
    data[4][0] = "    LogEC50";
    data[5][0] = "EC50";
    data[6][0] = "R (goodness of fit)";
    data[7][0] = "Standard error";
    data[8][0] = "    Bottom";
    data[9][0] = "    Top";
    data[10][0] = "    Hillslope";
    data[11][0] = "    LogEC50";
    data[12][0] = "95% Confidence interval";
    data[13][0] = "    Bottom";
    data[14][0] = "    Top";
    data[15][0] = "    Hillslope";
    data[16][0] = "    LogEC50";
    data[17][0] = "    EC50";

    //set second column (initial fitting results)
    SigmoidFittingResultsHolder fittingResults = analysisResults.getFittingResults(false);
    DoseResponseStatisticsHolder statistics = analysisResults.getStatistics(false);
    data[1][1] = AnalysisUtils.roundThreeDecimals(fittingResults.getBottom());
    data[2][1] = AnalysisUtils.roundThreeDecimals(fittingResults.getTop());
    data[3][1] = AnalysisUtils.roundThreeDecimals(fittingResults.getHillslope());
    data[4][1] = AnalysisUtils.roundThreeDecimals(fittingResults.getLogEC50());
    data[5][1] = df.format(analysisResults.getStatistics(false).getEc50());
    data[6][1] = AnalysisUtils.roundThreeDecimals(statistics.getGoodnessOfFit());
    //in case of bad fitting standard errors can be NaN, giving a NumberFormatException
    if (statistics.getStdErrBottom() != 0 && !(Double.isNaN(statistics.getStdErrBottom()))) {
        data[8][1] = AnalysisUtils.roundThreeDecimals(statistics.getStdErrBottom());
    } else {
        data[8][1] = "--";
    }
    if (statistics.getStdErrTop() != 0 && !(Double.isNaN(statistics.getStdErrTop()))) {
        data[9][1] = AnalysisUtils.roundThreeDecimals(statistics.getStdErrTop());
    } else {
        data[9][1] = "--";
    }
    data[10][1] = AnalysisUtils.roundThreeDecimals(statistics.getStdErrHillslope());
    try {
        data[11][1] = AnalysisUtils.roundThreeDecimals(statistics.getStdErrLogEC50());
    } catch (NumberFormatException e) {
        data[11][1] = "??";
    }
    if (data[8][1] != "--") {
        data[13][1] = AnalysisUtils.roundThreeDecimals(statistics.getcIBottom()[0]) + " to "
                + AnalysisUtils.roundThreeDecimals(statistics.getcIBottom()[1]);
    } else {
        data[13][1] = "--";
    }
    if (data[9][1] != "--") {
        data[14][1] = AnalysisUtils.roundThreeDecimals(statistics.getcITop()[0]) + " to "
                + AnalysisUtils.roundThreeDecimals(statistics.getcITop()[1]);
    } else {
        data[14][1] = "--";
    }
    data[15][1] = AnalysisUtils.roundThreeDecimals(statistics.getcIHillslope()[0]) + " to "
            + AnalysisUtils.roundThreeDecimals(statistics.getcIHillslope()[1]);
    if (data[11][1] != "??") {
        data[16][1] = AnalysisUtils.roundThreeDecimals(statistics.getcILogEC50()[0]) + " to "
                + AnalysisUtils.roundThreeDecimals(statistics.getcILogEC50()[1]);
        data[17][1] = df.format(statistics.getcIEC50()[0]) + " to " + df.format(statistics.getcIEC50()[1]);
    } else {
        data[16][1] = "--";
        data[17][1] = "--";
    }

    //set third column (normalized fitting results)
    fittingResults = analysisResults.getFittingResults(true);
    statistics = analysisResults.getStatistics(true);
    data[1][2] = AnalysisUtils.roundThreeDecimals(fittingResults.getBottom());
    data[2][2] = AnalysisUtils.roundThreeDecimals(fittingResults.getTop());
    data[3][2] = AnalysisUtils.roundThreeDecimals(fittingResults.getHillslope());
    data[4][2] = AnalysisUtils.roundThreeDecimals(fittingResults.getLogEC50());
    data[5][2] = df.format(statistics.getEc50());
    data[6][2] = AnalysisUtils.roundThreeDecimals(statistics.getGoodnessOfFit());
    if (statistics.getStdErrBottom() != 0 && !(Double.isNaN(statistics.getStdErrBottom()))) {
        data[8][2] = AnalysisUtils.roundThreeDecimals(statistics.getStdErrBottom());
    } else {
        data[8][2] = "--";
    }
    if (statistics.getStdErrTop() != 0 && !(Double.isNaN(statistics.getStdErrTop()))) {
        data[9][2] = AnalysisUtils.roundThreeDecimals(statistics.getStdErrTop());
    } else {
        data[9][2] = "--";
    }
    data[10][2] = AnalysisUtils.roundThreeDecimals(statistics.getStdErrHillslope());
    try {
        data[11][2] = AnalysisUtils.roundThreeDecimals(statistics.getStdErrLogEC50());
    } catch (NumberFormatException e) {
        data[11][2] = "??";
    }
    if (data[8][2] != "--") {
        data[13][2] = AnalysisUtils.roundThreeDecimals(statistics.getcIBottom()[0]) + " to "
                + AnalysisUtils.roundThreeDecimals(statistics.getcIBottom()[1]);
    } else {
        data[13][2] = "--";
    }
    if (data[9][2] != "--") {
        data[14][2] = AnalysisUtils.roundThreeDecimals(statistics.getcITop()[0]) + " to "
                + AnalysisUtils.roundThreeDecimals(statistics.getcITop()[1]);
    } else {
        data[14][2] = "--";
    }
    data[15][2] = AnalysisUtils.roundThreeDecimals(statistics.getcIHillslope()[0]) + " to "
            + AnalysisUtils.roundThreeDecimals(statistics.getcIHillslope()[1]);
    if (data[11][1] != "??") {
        data[16][2] = AnalysisUtils.roundThreeDecimals(statistics.getcILogEC50()[0]) + " to "
                + AnalysisUtils.roundThreeDecimals(statistics.getcILogEC50()[1]);
        data[17][2] = df.format(statistics.getcIEC50()[0]) + " to " + df.format(statistics.getcIEC50()[1]);
    } else {
        data[16][2] = "--";
        data[17][2] = "--";
    }

    String[] columnNames = new String[data[0].length];
    columnNames[0] = "";
    columnNames[1] = "Initial fitting";
    columnNames[2] = "Normalized fitting";

    NonEditableTableModel nonEditableTableModel = new NonEditableTableModel();
    nonEditableTableModel.setDataVector(data, columnNames);
    return nonEditableTableModel;
}