mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.
58 lines (40 loc) • 1.55 kB
Markdown
Compute the prob order quantile of a matrix or a list with values.
The sequence is sorted and the middle value is returned.
Supported types of sequence values are: Number, BigNumber, Unit
Supported types of probability are: Number, BigNumber
In case of a (multi dimensional) array or matrix, the prob order quantile
of all elements will be calculated.
## Syntax
```js
math.quantileSeq(A, prob[, sorted])
math.quantileSeq(A, [prob1, prob2, ...][, sorted])
math.quantileSeq(A, N[, sorted])
```
### Parameters
Parameter | Type | Description
--------- | ---- | -----------
`data` | Array, Matrix | A single matrix or Array
`probOrN` | Number, BigNumber, Array | prob is the order of the quantile, while N is the amount of evenly distributed steps of probabilities; only one of these options can be provided
`sorted` | Boolean | =false is data sorted in ascending order
Type | Description
---- | -----------
Number, BigNumber, Unit, Array | Quantile(s)
```js
math.quantileSeq([3, -1, 5, 7], 0.5); // returns 4
math.quantileSeq([3, -1, 5, 7], [1/3, 2/3]); // returns [3, 5]
math.quantileSeq([3, -1, 5, 7], 2); // returns [3, 5]
math.quantileSeq([-1, 3, 5, 7], 0.5, true); // returns 4
```
[](median.md),
[](mean.md),
[](min.md),
[](max.md),
[](sum.md),
[](prod.md),
[](std.md),
[](var.md)
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->