median
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
Contents
median
Calculate the median of the vector x.
Usage:
median(x)
median(x,q)
Parameters:
- x
- The data vector.
- q
- The cut point (
0
< q <1
) or a vector of cut points. If no cut point is specified,0.5
is used. If q is a vector, each element q[i]
must be in the range0
to1
.
Return Type:
scalar
Result:
The value xq
with sum(h(
x <= xq)) =
q
If q is a vector the result is a vector xq
with nrow(
q)
elements with: h(
x |
x<=xq[i]) =
q[i]