time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

index.js (1431B)


      1 /**
      2 * @license Apache-2.0
      3 *
      4 * Copyright (c) 2018 The Stdlib Authors.
      5 *
      6 * Licensed under the Apache License, Version 2.0 (the "License");
      7 * you may not use this file except in compliance with the License.
      8 * You may obtain a copy of the License at
      9 *
     10 *    http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing, software
     13 * distributed under the License is distributed on an "AS IS" BASIS,
     14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15 * See the License for the specific language governing permissions and
     16 * limitations under the License.
     17 */
     18 
     19 'use strict';
     20 
     21 /**
     22 * Compute a Kolmogorov-Smirnov goodness-of-fit test.
     23 *
     24 * @module @stdlib/stats/kstest
     25 *
     26 * @example
     27 * var generator = require( '@stdlib/random/base/normal' ).factory;
     28 * var kstest = require( '@stdlib/stats/kstest' );
     29 *
     30 * var rnorm;
     31 * var out;
     32 * var i;
     33 * var x;
     34 *
     35 * // Values drawn from a Normal(3,1) distribution
     36 * rnorm = generator( 3.0, 1.0, {
     37 *     'seed': 293
     38 * });
     39 * x = new Array( 100 );
     40 * for ( i = 0; i < 100; i++ ) {
     41 *     x[ i ] = rnorm();
     42 * }
     43 *
     44 * // Test against N(0,1)
     45 * out = kstest( x, 'normal', 0.0, 1.0 );
     46 * // returns { pValue: 0, statistic: ~0.901, ... }
     47 *
     48 * // Test against N(3,1)
     49 * out = kstest( x, 'normal', 3.0, 1.0 );
     50 * // returns { pValue: ~0.234, statistic: ~0.102, ... }
     51 */
     52 
     53 // MODULES //
     54 
     55 var kstest = require( './main.js' );
     56 
     57 
     58 // EXPORTS //
     59 
     60 module.exports = kstest;