Programmer Guide/Command Reference/EVAL/median: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(3 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
Compute median or quantiles of a vector ''x''. | Compute median or quantiles of a vector ''x''. | ||
The quantile '''q<sub>p</sub>''' can be defined as the probability '''p''' such that ''an element of x is lower than '''q<sub>p</sub>''' | The quantile '''q<sub>p</sub>''' can be defined as the probability '''p''' such that ''an element of x is lower than'' '''q<sub>p</sub>'''. The value '''p''' must be in the range 0 to 1. The special quantile q<sub>0.5</sub> is also called '''median'''. | ||
---- | ---- | ||
;Usage 1: | ;Usage 1: <code>median(''x''<sub>vector</sub> {, ''p''<sub>scalar</sub> })</code> | ||
;''x'': data vector | ;''x'': data vector | ||
;''p'': the propability; 0 < ''p'' < 1 (default=0.5) | ;''p'': the propability; 0 < ''p'' < 1 (default=0.5) | ||
;Result 1: Returns the ''p''-quantile (scalar) of ''x''. | ;Result 1: Returns the ''p''-quantile (scalar) of ''x''. | ||
---- | ---- | ||
;Usage 2: | ;Usage 2: <code>median(''x''<sub>vector</sub> , ''p''<sub>vector</sub> })</code> | ||
;''x'': data vector | ;''x'': data vector | ||
;''p'': vector with propability values | ;''p'': vector with propability values | ||
;Result 1: Returns a vector containing the quantiles for all probabilities p[i]. | ;Result 1: Returns a vector containing the quantiles for all probabilities p[i]. | ||
;See also: [[../avr|avr]], [[../sort|sort]], [[../hist|hist]] | |||
[[../#Functions|<function list>]] | |||
Latest revision as of 11:20, 21 April 2011
Compute median or quantiles of a vector x.
The quantile qp can be defined as the probability p such that an element of x is lower than qp. The value p must be in the range 0 to 1. The special quantile q0.5 is also called median.
- Usage 1
median(xvector {, pscalar })
- x
- data vector
- p
- the propability; 0 < p < 1 (default=0.5)
- Result 1
- Returns the p-quantile (scalar) of x.