Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: tools/telemetry/third_party/WebKit/PerformanceTests/resources/statistics.js

Issue 1309143006: [Telemetry] Update the ConfindenceInterval calculation in results.html to use (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/third_party/WebKit/PerformanceTests/resources/statistics.js
diff --git a/tools/telemetry/third_party/WebKit/PerformanceTests/resources/statistics.js b/tools/telemetry/third_party/WebKit/PerformanceTests/resources/statistics.js
index f5269c2c2b8769e43c65fc1c090d548a83b54520..4ed70d7fe24bd7caa82f42ab69177dbd8f6321fc 100644
--- a/tools/telemetry/third_party/WebKit/PerformanceTests/resources/statistics.js
+++ b/tools/telemetry/third_party/WebKit/PerformanceTests/resources/statistics.js
@@ -65,8 +65,7 @@ var Statistics = new (function () {
return supportedLevels;
}
- // Computes the delta d s.t. (mean - d, mean + d) is the confidence interval with the specified confidence level in O(1).
- this.confidenceIntervalDelta = function (confidenceLevel, numberOfSamples, sum, squareSum) {
+ this.quantile = function (confidenceLevel, numberOfSamples) {
var probability = (1 - (1 - confidenceLevel) / 2);
if (!(probability in tDistributionInverseCDF)) {
console.warn('We only support ' + this.supportedConfidenceLevels().map(
@@ -81,16 +80,27 @@ var Statistics = new (function () {
// tDistributionQuantile(degreesOfFreedom, confidenceLevel) * sampleStandardDeviation / sqrt(numberOfSamples) * S/sqrt(numberOfSamples)
if (degreesOfFreedom <= 100)
- var quantile = cdfForProbability[degreesOfFreedom - 1]; // The first entry is for the one degree of freedom.
+ return cdfForProbability[degreesOfFreedom - 1]; // The first entry is for the one degree of freedom.
else if (degreesOfFreedom <= 300)
- var quantile = cdfForProbability[Math.round(degreesOfFreedom / 10) + 100 - 10 - 1];
+ return cdfForProbability[Math.round(degreesOfFreedom / 10) + 100 - 10 - 1];
else if (degreesOfFreedom <= 1300)
- var quantile = cdfForProbability[Math.round(degreesOfFreedom / 100) + 120 - 3 - 1];
+ return cdfForProbability[Math.round(degreesOfFreedom / 100) + 120 - 3 - 1];
else
- var quantile = cdfForProbability[cdfForProbability.length - 1];
+ return cdfForProbability[cdfForProbability.length - 1];
+ }
+
+ // Computes the delta d s.t. (mean - d, mean + d) is the confidence interval with the specified confidence level in O(1).
+ this.confidenceIntervalDelta = function (confidenceLevel, numberOfSamples, sum, squareSum) {
petrcermak 2015/09/09 18:44:40 To reduce code duplication, this function should u
nednguyen 2015/09/09 22:29:06 Done.
+ var quantile = this.quantile(confidenceLevel, numberOfSamples);
return quantile * this.sampleStandardDeviation(numberOfSamples, sum, squareSum) / Math.sqrt(numberOfSamples);
}
+ this.confidenceIntervalDeltaFromStd = function (confidenceLevel, numberOfSamples, sampleStandardDeviation) {
+ var quantile = this.quantile(confidenceLevel, numberOfSamples);
+ return quantile * sampleStandardDeviation / Math.sqrt(numberOfSamples);
+ }
+
+
this.confidenceInterval = function (values, probability) {
var sum = this.sum(values);
var mean = sum / values.length;

Powered by Google App Engine
This is Rietveld 408576698