Compute the distribution sample median of the vector of values given as its argument.

# S3 method for rv
median(x, na.rm = FALSE, ...)

Arguments

x

a randomv vector containing the components whose distribution of the median value is to be computed.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

...

further arguments passed to median

References

Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.

See also vignette("rv").

See also

rvmedian for the componentwise medians. quantile for general quantiles.

Examples


  x <- rvnorm(10) ## A random vector of length 10.
  median(x)       ## A random scalar (vector of length 1).
#>      mean   sd   1% 2.5%   25%  50%  75% 97.5%  99% sims
#> [1] 0.013 0.34 -0.7 -0.6 -0.25 0.01 0.22  0.61 0.67  200
  rvmedian(x)     ## A numeric vector of length 10.
#>  [1]  0.042322748 -0.072534072 -0.164801982  0.101193327  0.070051086
#>  [6]  0.192204197  0.006350066 -0.035398106 -0.029782575 -0.111031945