{"_id":"distributions-rayleigh-cdf","_rev":"5-626e739b2abe1218ba87f131a9696f9e","name":"distributions-rayleigh-cdf","description":"Rayleigh distribution cumulative distribution function (CDF).","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.0":{"name":"distributions-rayleigh-cdf","version":"0.0.0","description":"Rayleigh distribution cumulative distribution function (CDF).","author":{"name":"Philipp Burckhardt","email":"pburckhardt@outlook.com"},"contributors":[{"name":"Philipp Burckhardt","email":"pburckhardt@outlook.com"}],"scripts":{"test":"mocha","test-cov":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coverage -- -R spec","coveralls":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coveralls/coverage --report lcovonly -- -R spec && cat ./reports/coveralls/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./reports/coveralls"},"main":"./lib","repository":{"type":"git","url":"git://github.com/distributions-io/rayleigh-cdf.git"},"keywords":["distributions.io","distributions","probability","statistics","stats","cdf","cumulative distribution","distribution function"],"bugs":{"url":"https://github.com/distributions-io/rayleigh-cdf/issues"},"dependencies":{"compute-array-constructors":"^1.0.0","dstructs-matrix":"^2.0.0","utils-deep-get":"^1.0.0","utils-deep-set":"^1.0.1","validate.io-array-like":"^1.0.1","validate.io-boolean-primitive":"^1.0.0","validate.io-function":"^1.0.2","validate.io-matrix-like":"^1.0.2","validate.io-nan":"^1.0.3","validate.io-nonnegative-integer":"^1.0.0","validate.io-number-primitive":"^1.0.0","validate.io-object":"^1.0.4","validate.io-positive-primitive":"^1.0.0","validate.io-string-primitive":"^1.0.0","validate.io-typed-array-like":"^1.0.0"},"devDependencies":{"chai":"3.x.x","mocha":"2.x.x","coveralls":"^2.11.1","istanbul":"^0.3.0","jshint":"2.x.x","jshint-stylish":"2.x.x","validate.io-finite":"^1.0.0"},"license":"MIT","gitHead":"c335cabfc69a97574b4508c97f5a49b5c9fda325","homepage":"https://github.com/distributions-io/rayleigh-cdf#readme","_id":"distributions-rayleigh-cdf@0.0.0","_shasum":"31a3e3ed234e1e57a1e0ba568770d829372f3d58","_from":".","_npmVersion":"2.8.4","_nodeVersion":"4.0.0","_npmUser":{"name":"planeshifter","email":"pgb@andrew.cmu.edu"},"dist":{"shasum":"31a3e3ed234e1e57a1e0ba568770d829372f3d58","tarball":"https://registry.npmjs.org/distributions-rayleigh-cdf/-/distributions-rayleigh-cdf-0.0.0.tgz","integrity":"sha512-jZ8ympNcCEjWis6Rgf36hA7OPPorBmmGiTIEeXr7oUjnq2ob6QMVJfOgeQr6kQT0gHkiqGO0TBuHnr9KiuJIfQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEesL3LVAEfr8G1D6Fopqkdc2GvhwR7YVmUtjJBtd/V7AiEA5+eGAD0jrx6r7heYGSfXkgJj0UpLspxHiy/5JTFB6xM="}]},"maintainers":[{"name":"planeshifter","email":"pgb@andrew.cmu.edu"}]},"0.0.1":{"name":"distributions-rayleigh-cdf","version":"0.0.1","description":"Rayleigh distribution cumulative distribution function (CDF).","author":{"name":"Philipp Burckhardt","email":"pburckhardt@outlook.com"},"contributors":[{"name":"Philipp Burckhardt","email":"pburckhardt@outlook.com"}],"scripts":{"test":"mocha","test-cov":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/coverage -- -R spec","codecov":"istanbul cover ./node_modules/.bin/_mocha --dir ./reports/codecov/coverage --report lcovonly -- -R spec && cat ./reports/codecov/coverage/lcov.info | codecov && rm -rf ./reports/codecov"},"main":"./lib","repository":{"type":"git","url":"git://github.com/distributions-io/rayleigh-cdf.git"},"keywords":["distributions.io","distributions","probability","statistics","stats","cdf","cumulative distribution","distribution function"],"bugs":{"url":"https://github.com/distributions-io/rayleigh-cdf/issues"},"dependencies":{"compute-array-constructors":"^1.0.0","dstructs-matrix":"^2.0.0","utils-deep-get":"^1.0.0","utils-deep-set":"^1.0.1","validate.io-array-like":"^1.0.1","validate.io-boolean-primitive":"^1.0.0","validate.io-function":"^1.0.2","validate.io-matrix-like":"^1.0.2","validate.io-nan":"^1.0.3","validate.io-nonnegative-integer":"^1.0.0","validate.io-number-primitive":"^1.0.0","validate.io-object":"^1.0.4","validate.io-positive-primitive":"^1.0.0","validate.io-string-primitive":"^1.0.0","validate.io-typed-array-like":"^1.0.0"},"devDependencies":{"chai":"3.x.x","mocha":"2.x.x","codecov.io":"^0.1.5","istanbul":"^0.3.0","jshint":"2.x.x","jshint-stylish":"2.x.x","validate.io-finite":"^1.0.0"},"license":"MIT","gitHead":"cb1c4bc29291bda04d45db49b9b58ac315e2d72a","homepage":"https://github.com/distributions-io/rayleigh-cdf#readme","_id":"distributions-rayleigh-cdf@0.0.1","_shasum":"49fdc0a2e14578892ef42082025e1a6005d3f1d9","_from":".","_npmVersion":"2.8.4","_nodeVersion":"4.0.0","_npmUser":{"name":"planeshifter","email":"pgb@andrew.cmu.edu"},"dist":{"shasum":"49fdc0a2e14578892ef42082025e1a6005d3f1d9","tarball":"https://registry.npmjs.org/distributions-rayleigh-cdf/-/distributions-rayleigh-cdf-0.0.1.tgz","integrity":"sha512-z4uLDibOGQIuK+NakhpJRy5V+2E7kiXqjr1c85B3IXApJLRaiMvGA7eVpf/B7bqW7cgpMGXjpc+H9NlfG4z3tA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDDpg6mWhKA6XLgLgEKy2EOsV2Jps2my5TBcy0vf9zdmgIgGOkRd7dBubEZTnzgXQPrL10Fyi52VP3RHhksKTKUWRA="}]},"maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"},{"name":"planeshifter","email":"pgb@andrew.cmu.edu"}]}},"readme":"Cumulative Distribution Function\n===\n[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependencies][dependencies-image]][dependencies-url]\n\n> [Rayleigh](https://en.wikipedia.org/wiki/Rayleigh_distribution) distribution [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function).\n\nThe [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) for a [Rayleigh](https://en.wikipedia.org/wiki/Rayleigh_distribution) random variable is\n\n<div class=\"equation\" align=\"center\" data-raw-text=\"F(x;\\sigma) = \\begin{cases}\n0 &amp; \\text{ for } x < 0 \\\\\n1 - e^{-x^2/2\\sigma^2} &amp; \\text{ for } x \\ge 0\n\\end{cases} \" data-equation=\"eq:cdf\">\n\t<img src=\"https://cdn.rawgit.com/distributions-io/rayleigh-cdf/dc9d27df02622b24a327b54d839c83bb3be3f327/docs/img/eqn.svg\" alt=\"Cumulative distribution function for a Rayleigh distribution.\">\n\t<br>\n</div>\n\nwhere `sigma` is the scale parameter.\n\n## Installation\n\n``` bash\n$ npm install distributions-rayleigh-cdf\n```\n\nFor use in the browser, use [browserify](https://github.com/substack/node-browserify).\n\n\n## Usage\n\n``` javascript\nvar cdf = require( 'distributions-rayleigh-cdf' );\n```\n\n#### cdf( x[, options] )\n\nEvaluates the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) for the [Rayleigh](https://en.wikipedia.org/wiki/Rayleigh_distribution) distribution. `x` may be either a [`number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number), an [`array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array), a [`typed array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays), or a [`matrix`](https://github.com/dstructs/matrix).\n\n``` javascript\nvar matrix = require( 'dstructs-matrix' ),\n\tmat,\n\tout,\n\tx,\n\ti;\n\nout = cdf( 1 );\n// returns ~0.393\n\nx = [ -1, 0, 1, 2, 3 ];\nout = cdf( x );\n// returns [ 0, 0, ~0.393, ~0.865, ~0.989 ]\n\nx = new Float32Array( x );\nout = cdf( x );\n// returns Float64Array( [0,0,~0.393,~0.865,~0.989] )\n\nx = new Float32Array( 6 );\nfor ( i = 0; i < 6; i++ ) {\n\tx[ i ] = i;\n}\nmat = matrix( x, [3,2], 'float32' );\n/*\n\t[ 0 1\n\t  2 3\n\t  3 5 ]\n*/\n\nout = cdf( mat );\n/*\n\t[ 0     ~0.393\n\t ~0.865 ~0.989\n\t ~1     ~1    ]\n*/\n```\n\nThe function accepts the following `options`:\n\n*\t__sigma__: scale parameter. Default: `1`.\n* \t__accessor__: accessor `function` for accessing `array` values.\n* \t__dtype__: output [`typed array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays) or [`matrix`](https://github.com/dstructs/matrix) data type. Default: `float64`.\n*\t__copy__: `boolean` indicating if the `function` should return a new data structure. Default: `true`.\n*\t__path__: [deepget](https://github.com/kgryte/utils-deep-get)/[deepset](https://github.com/kgryte/utils-deep-set) key path.\n*\t__sep__: [deepget](https://github.com/kgryte/utils-deep-get)/[deepset](https://github.com/kgryte/utils-deep-set) key path separator. Default: `'.'`.\n\nA [Rayleigh](https://en.wikipedia.org/wiki/Rayleigh_distribution) distribution is a function of one parameter: `sigma`(scale parameter). By default, `sigma` is equal to `1`. To adjust it, set the corresponding option.\n\n``` javascript\nvar x = [ -1, 0, 1, 2, 3 ];\n\nvar out = cdf( x, {\n\t'sigma': 7\n});\n// returns [ 0, 0, ~0.0102, ~0.04, ~0.0877 ]\n```\n\nFor non-numeric `arrays`, provide an accessor `function` for accessing `array` values.\n\n``` javascript\nvar data = [\n\t[0,-1],\n\t[1,0],\n\t[2,1],\n\t[3,2],\n\t[4,3],\n];\n\nfunction getValue( d, i ) {\n\treturn d[ 1 ];\n}\n\nvar out = cdf( data, {\n\t'accessor': getValue\n});\n// returns [ 0, 0, ~0.393, ~0.865, ~0.989 ]\n```\n\n\nTo [deepset](https://github.com/kgryte/utils-deep-set) an object `array`, provide a key path and, optionally, a key path separator.\n\n``` javascript\nvar data = [\n\t{'x':[0,-4]},\n\t{'x':[1,-2]},\n\t{'x':[2,0]},\n\t{'x':[3,2]},\n\t{'x':[4,4]},\n];\n\nvar out = cdf( data, {\n\t'path': 'x/1',\n\t'sep': '/'\n});\n/*\n\t[\n\t\t{'x':[0,0]},\n\t\t{'x':[1,0]},\n\t\t{'x':[2,~0.393]},\n\t\t{'x':[3,~0.865]},\n\t\t{'x':[4,~0.989]},\n\t]\n*/\n\nvar bool = ( data === out );\n// returns true\n```\n\nBy default, when provided a [`typed array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays) or [`matrix`](https://github.com/dstructs/matrix), the output data structure is `float64` in order to preserve precision. To specify a different data type, set the `dtype` option (see [`matrix`](https://github.com/dstructs/matrix) for a list of acceptable data types).\n\n``` javascript\nvar x, out;\n\nx = new Float64Array( [-1,0,1,2,3] );\n\nout = cdf( x, {\n\t'dtype': 'float32'\n});\n// returns Float32Array( [0,0,~0.393,~0.865,~0.989] )\n\n// Works for plain arrays, as well...\nout = cdf( [-1,0,1,2,3], {\n\t'dtype': 'float32'\n});\n// returns Float32Array( [0,0,~0.393,~0.865,~0.989] )\n```\n\nBy default, the function returns a new data structure. To mutate the input data structure (e.g., when input values can be discarded or when optimizing memory usage), set the `copy` option to `false`.\n\n``` javascript\nvar bool,\n\tmat,\n\tout,\n\tx,\n\ti;\n\nx = [ -1, 0, 1, 2, 3 ];\n\nout = cdf( x, {\n\t'copy': false\n});\n// returns [ 0, 0, ~0.0102, ~0.04, ~0.0877 ]\n\nbool = ( x === out );\n// returns true\n\nx = new Float32Array( 6 );\nfor ( i = 0; i < 6; i++ ) {\n\tx[ i ] = i;\n}\nmat = matrix( x, [3,2], 'float32' );\n/*\n\t[ 0 1\n\t  2 3\n\t  3 5 ]\n*/\n\n\nout = cdf( mat, {\n\t'copy': false\n});\n/*\n\t[ 0     ~0.393\n\t ~0.865 ~0.989\n\t ~1     ~1    ]\n*/\n\nbool = ( mat === out );\n// returns true\n```\n\n\n## Notes\n\n*\tIf an element is __not__ a numeric value, the evaluated [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) is `NaN`.\n\n\t``` javascript\n\tvar data, out;\n\n\tout = cdf( null );\n\t// returns NaN\n\n\tout = cdf( true );\n\t// returns NaN\n\n\tout = cdf( {'a':'b'} );\n\t// returns NaN\n\n\tout = cdf( [ true, null, [] ] );\n\t// returns [ NaN, NaN, NaN ]\n\n\tfunction getValue( d, i ) {\n\t\treturn d.x;\n\t}\n\tdata = [\n\t\t{'x':true},\n\t\t{'x':[]},\n\t\t{'x':{}},\n\t\t{'x':null}\n\t];\n\n\tout = cdf( data, {\n\t\t'accessor': getValue\n\t});\n\t// returns [ NaN, NaN, NaN, NaN ]\n\n\tout = cdf( data, {\n\t\t'path': 'x'\n\t});\n\t/*\n\t\t[\n\t\t\t{'x':NaN},\n\t\t\t{'x':NaN},\n\t\t\t{'x':NaN,\n\t\t\t{'x':NaN}\n\t\t]\n\t*/\n\t```\n\n## Examples\n\n``` javascript\nvar cdf = require( 'distributions-rayleigh-cdf' ),\n\tmatrix = require( 'dstructs-matrix' );\n\nvar data,\n\tmat,\n\tout,\n\ttmp,\n\ti;\n\n// Plain arrays...\ndata = new Array( 10 );\nfor ( i = 0; i < data.length; i++ ) {\n\tdata[ i ] = i / 2;\n}\nout = cdf( data );\n\n// Object arrays (accessors)...\nfunction getValue( d ) {\n\treturn d.x;\n}\nfor ( i = 0; i < data.length; i++ ) {\n\tdata[ i ] = {\n\t\t'x': data[ i ]\n\t};\n}\nout = cdf( data, {\n\t'accessor': getValue\n});\n\n// Deep set arrays...\nfor ( i = 0; i < data.length; i++ ) {\n\tdata[ i ] = {\n\t\t'x': [ i, data[ i ].x ]\n\t};\n}\nout = cdf( data, {\n\t'path': 'x/1',\n\t'sep': '/'\n});\n\n// Typed arrays...\ndata = new Float32Array( 10 );\nfor ( i = 0; i < data.length; i++ ) {\n\tdata[ i ] = i / 2;\n}\nout = cdf( data );\n\n// Matrices...\nmat = matrix( data, [5,2], 'float32' );\nout = cdf( mat );\n\n// Matrices (custom output data type)...\nout = cdf( mat, {\n\t'dtype': 'uint8'\n});\n```\n\nTo run the example code from the top-level application directory,\n\n``` bash\n$ node ./examples/index.js\n```\n\n\n## Tests\n\n### Unit\n\nUnit tests use the [Mocha](http://mochajs.org/) test framework with [Chai](http://chaijs.com) assertions. To run the tests, execute the following command in the top-level application directory:\n\n``` bash\n$ make test\n```\n\nAll new feature development should have corresponding unit tests to validate correct functionality.\n\n\n### Test Coverage\n\nThis repository uses [Istanbul](https://github.com/gotwarlost/istanbul) as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:\n\n``` bash\n$ make test-cov\n```\n\nIstanbul creates a `./reports/coverage` directory. To access an HTML version of the report,\n\n``` bash\n$ make view-cov\n```\n\n\n---\n## License\n\n[MIT license](http://opensource.org/licenses/MIT).\n\n\n## Copyright\n\nCopyright &copy; 2015. The [Compute.io](https://github.com/compute-io) Authors.\n\n\n[npm-image]: http://img.shields.io/npm/v/distributions-rayleigh-cdf.svg\n[npm-url]: https://npmjs.org/package/distributions-rayleigh-cdf\n\n[travis-image]: http://img.shields.io/travis/distributions-io/rayleigh-cdf/master.svg\n[travis-url]: https://travis-ci.org/distributions-io/rayleigh-cdf\n\n[codecov-image]: https://img.shields.io/codecov/c/github/distributions-io/rayleigh-cdf/master.svg\n[codecov-url]: https://coveralls.io/github/distributions-io/rayleigh-cdf?branch=master\n\n[dependencies-image]: http://img.shields.io/david/distributions-io/rayleigh-cdf.svg\n[dependencies-url]: https://david-dm.org/distributions-io/rayleigh-cdf\n\n[dev-dependencies-image]: http://img.shields.io/david/dev/distributions-io/rayleigh-cdf.svg\n[dev-dependencies-url]: https://david-dm.org/dev/distributions-io/rayleigh-cdf\n\n[github-issues-image]: http://img.shields.io/github/issues/distributions-io/rayleigh-cdf.svg\n[github-issues-url]: https://github.com/distributions-io/rayleigh-cdf/issues\n","maintainers":[{"name":"kgryte","email":"kgryte@gmail.com"},{"name":"planeshifter","email":"pgb@andrew.cmu.edu"}],"time":{"modified":"2022-06-15T05:27:33.377Z","created":"2015-11-04T09:24:19.062Z","0.0.0":"2015-11-04T09:24:19.062Z","0.0.1":"2015-11-05T02:23:05.880Z"},"homepage":"https://github.com/distributions-io/rayleigh-cdf#readme","keywords":["distributions.io","distributions","probability","statistics","stats","cdf","cumulative distribution","distribution function"],"repository":{"type":"git","url":"git://github.com/distributions-io/rayleigh-cdf.git"},"contributors":[{"name":"Philipp Burckhardt","email":"pburckhardt@outlook.com"}],"author":{"name":"Philipp Burckhardt","email":"pburckhardt@outlook.com"},"bugs":{"url":"https://github.com/distributions-io/rayleigh-cdf/issues"},"license":"MIT","readmeFilename":"README.md"}