List of usage examples for org.apache.commons.math3.stat.descriptive SummaryStatistics getStandardDeviation
public double getStandardDeviation()
From source file:Server.ReadTXTFile.java
private static double calcMeanCI(SummaryStatistics stats, double level) { try {/* w ww . j ava 2s . c om*/ // Create T Distribution with N-1 degrees of freedom TDistribution tDist = new TDistribution(stats.getN() - 1); // Calculate critical value double critVal = tDist.inverseCumulativeProbability(1.0 - (1 - level) / 2); // Calculate confidence interval return critVal * stats.getStandardDeviation() / Math.sqrt(stats.getN()); } catch (MathIllegalArgumentException e) { return Double.NaN; } }
From source file:tech.tablesaw.columns.numbers.Stats.java
private static Stats getStats(NumericColumn<?> values, SummaryStatistics summaryStatistics) { Stats stats = new Stats("Column: " + values.name()); stats.min = summaryStatistics.getMin(); stats.max = summaryStatistics.getMax(); stats.n = summaryStatistics.getN();// ww w.j a v a 2 s. co m stats.sum = summaryStatistics.getSum(); stats.variance = summaryStatistics.getVariance(); stats.populationVariance = summaryStatistics.getPopulationVariance(); stats.quadraticMean = summaryStatistics.getQuadraticMean(); stats.geometricMean = summaryStatistics.getGeometricMean(); stats.mean = summaryStatistics.getMean(); stats.standardDeviation = summaryStatistics.getStandardDeviation(); stats.sumOfLogs = summaryStatistics.getSumOfLogs(); stats.sumOfSquares = summaryStatistics.getSumsq(); stats.secondMoment = summaryStatistics.getSecondMoment(); return stats; }
From source file:tools.descartes.bungee.evaluation.ScalabilityReproducibilityEvaluation.java
private void printStatistics(SummaryStatistics summaryStats, double lowerConfidence, double upperConfidence, double wantedLower, double wantedUpper, boolean finished) { System.out.println("total runs: " + summaryStats.getN()); System.out.println("mean: " + summaryStats.getMean()); System.out.println("stdDev: " + summaryStats.getStandardDeviation()); System.out.println("confidence interval [" + lowerConfidence + "," + upperConfidence + "]"); System.out.println("wanted interval [" + wantedLower + "," + wantedUpper + "]"); System.out.println("success: " + finished); }
From source file:tools.descartes.bungee.evaluation.ScalabilityReproducibilityEvaluation.java
private void writeEvaluationResultsToFile(List<Double> firstStepResults, SummaryStatistics summaryStats, double lowerConfidence, double upperConfidence, double wantedLower, double wantedUpper, boolean finished) { String resultsString = analysisResultCSVString(firstStepResults); PrintWriter writer;/*from ww w. j av a2s . c o m*/ try { writer = new PrintWriter( new File(measurementFolder, cloudSettings.getOffering() + "-evaluationResults.csv"), FileUtility.ENOCDING); writer.println(resultsString); writer.println("runs: " + FileUtility.CSV_SPLIT_BY + summaryStats.getN()); writer.println("mean" + FileUtility.CSV_SPLIT_BY + summaryStats.getMean()); writer.println("stdDev" + FileUtility.CSV_SPLIT_BY + summaryStats.getStandardDeviation()); writer.println(Double.toString(diffPercent * 100) + "%-interval" + FileUtility.CSV_SPLIT_BY + Double.toString(wantedLower) + FileUtility.CSV_SPLIT_BY + Double.toString(wantedUpper)); writer.println(Double.toString(confidence * 100) + "% confidence interval" + FileUtility.CSV_SPLIT_BY + Double.toString(lowerConfidence) + FileUtility.CSV_SPLIT_BY + Double.toString(upperConfidence)); writer.println("confidence interval small enough" + FileUtility.CSV_SPLIT_BY + finished); writer.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }
From source file:tools.descartes.bungee.evaluation.ScalabilityReproducibilityEvaluation.java
private double getConfidenceIntervalWidth(SummaryStatistics summaryStatistics, double confidence) { double significance = 1 - confidence; TDistribution tDist = new TDistribution(summaryStatistics.getN() - 1); double a = tDist.inverseCumulativeProbability(1.0 - significance / 2); return a * summaryStatistics.getStandardDeviation() / Math.sqrt(summaryStatistics.getN()); }
From source file:uk.ac.diamond.scisoft.ncd.calibration.NCDAbsoluteCalibration.java
public void calibrate() { qMin = Math.max(absQ.min().doubleValue(), dataQ.min().doubleValue()); qMax = Math.min(absQ.max().doubleValue(), dataQ.max().doubleValue()); if (!(qMin < qMax)) { throw new IllegalArgumentException( "No calibration data found for the selected scattering vector range"); }//from w ww .j av a 2 s . c o m int dataQStart = Math.min(dataQ.getSize() - 1, DatasetUtils.findIndexGreaterThanOrEqualTo(dataQ, qMin)); int dataQStop = Math.min(dataQ.getSize() - 1, DatasetUtils.findIndexGreaterThanOrEqualTo(dataQ, qMax)); SummaryStatistics stats = new SummaryStatistics(); for (int i = dataQStart; i <= dataQStop; i++) { double qval = dataQ.getDouble(i); stats.addValue(absInterpolate.value(qval) / dataI.getDouble(i)); } absScale = stats.getMean(); absScaleStdDev = stats.getStandardDeviation(); String msg = StringUtils.join(new String[] { "scale", Double.toString(absScale) }, " : "); System.out.println(msg); System.out.println("NCD Absolute Instensity Scaler"); System.out.println(Double.toString(absScale)); System.out.println("standard deviation:" + Double.toString(absScaleStdDev)); calibratedData(dataI); }
From source file:wsattacker.plugin.dos.dosExtension.mvc.model.AttackModel.java
/** * Prints the result of the network stability Test */// w ww .j a va 2s . com public void generateNetworktestResult() { SummaryStatistics statistics = createNetworkStatistics(); double standarddeviationResult = statistics.getStandardDeviation(); double meanResult = statistics.getMean(); // get Coefficient of variation this.networkTestResult = (standarddeviationResult / meanResult); this.networkTestResult = Math.round(networkTestResult * 100.0) / 100.0; System.out.println("--------------------Ergebnis NETWORK:" + standarddeviationResult + " - " + meanResult + " - " + (standarddeviationResult / meanResult)); // get Result String if (this.networkTestResult < 0.5) { this.networkTestResultString = "stable"; } else if (this.networkTestResult >= 0.5 && this.networkTestResult < 2.0) { this.networkTestResultString = "noisy"; } else { this.networkTestResultString = "unstable"; } this.networkTestFinished = true; fireModelChanged(); }
From source file:wsattacker.plugin.intelligentdos.StatisticTest.java
private static double calcMeanCI(SummaryStatistics stats, double level) { // Create T Distribution with N-1 degrees of freedom TDistribution tDist = new TDistribution(stats.getN() - 1); // Calculate critical value double critVal = tDist.inverseCumulativeProbability(1.0 - (1 - level) / 2); // Calculate confidence interval return critVal * stats.getStandardDeviation() / Math.sqrt(stats.getN()); }
From source file:wsattacker.plugin.intelligentdos.StatisticTest.java
private static void standardDeviation(SummaryStatistics statisticsWithDrug, SummaryStatistics statisticsPlacebo) { System.out.println("standardDeviation: " + statisticsWithDrug.getStandardDeviation()); System.out.println("standardDeviation: " + statisticsPlacebo.getStandardDeviation()); }