| Index: tracing/tracing/base/statistics.html
|
| diff --git a/tracing/tracing/base/statistics.html b/tracing/tracing/base/statistics.html
|
| index 3b3408c0342701f8005a4042c8a124306cc77270..5aa686ab0e80d0b0a6812949acd67fee9667410f 100644
|
| --- a/tracing/tracing/base/statistics.html
|
| +++ b/tracing/tracing/base/statistics.html
|
| @@ -7,6 +7,26 @@ found in the LICENSE file.
|
|
|
| <link rel="import" href="/tracing/base/math.html">
|
| <link rel="import" href="/tracing/base/range.html">
|
| +<script src="/mannwhitneyu/mannwhitneyu.js"></script>
|
| +
|
| +<script>
|
| +'use strict';
|
| +// In node, the script-src for mannwhitneyu above brings in mannwhitneyui
|
| +// into a module, instead of into the global scope. Whereas this file
|
| +// assumes that mannwhitneyu is in the global scope. So, in Node only, we
|
| +// require() it in, and then take all its exports and shove them into the
|
| +// global scope by hand.
|
| +(function(global) {
|
| + if (tr.isNode) {
|
| + var mwuAbsPath = HTMLImportsLoader.hrefToAbsolutePath(
|
| + '/mannwhitneyu.js');
|
| + var mwuModule = require(mwuAbsPath);
|
| + for (var exportName in mwuModule) {
|
| + global[exportName] = mwuModule[exportName];
|
| + }
|
| + }
|
| +})(this);
|
| +</script>
|
|
|
| <script>
|
| 'use strict';
|
| @@ -131,13 +151,6 @@ tr.exportTo('tr.b', function() {
|
| return tmp[idx];
|
| };
|
|
|
| - /* Clamp a value between some low and high value. */
|
| - Statistics.clamp = function(value, opt_low, opt_high) {
|
| - opt_low = opt_low || 0.0;
|
| - opt_high = opt_high || 1.0;
|
| - return Math.min(Math.max(value, opt_low), opt_high);
|
| - };
|
| -
|
| /**
|
| * Sorts the samples, and map them linearly to the range [0,1].
|
| *
|
| @@ -342,8 +355,8 @@ tr.exportTo('tr.b', function() {
|
| discrepancy /= sample_scale;
|
| } else {
|
| // Compute relative discrepancy
|
| - discrepancy = Statistics.clamp(
|
| - (discrepancy - inv_sample_count) / (1.0 - inv_sample_count));
|
| + discrepancy = tr.b.clamp(
|
| + (discrepancy - inv_sample_count) / (1.0 - inv_sample_count), 0.0, 1.0);
|
| }
|
| return discrepancy;
|
| };
|
| @@ -739,6 +752,8 @@ tr.exportTo('tr.b', function() {
|
| return new Statistics.LogNormalDistribution(location, shape);
|
| };
|
|
|
| + Statistics.mwu = mannwhitneyu;
|
| +
|
| return {
|
| Statistics: Statistics
|
| };
|
|
|