Computes componentwise quantiles of random vectors or arrays.

rvquantile(x, ...)

# S3 method for rv
rvquantile(
  x,
  probs = c(0.025, 0.1, 0.25, 0.5, 0.75, 0.9, 0.975),
  ignoreInf = FALSE,
  ...
)

Arguments

x

an object

...

further arguments passed to quantile

probs

numeric vector of probabilities with values in [0,1]

ignoreInf

ignore infinite values

Value

A numeric vector of quantiles.

Details

rvquantile applies the quantile function to each column of sims(x).

rvmedian applies median to the each column of sims(x).

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").

Author

Jouni Kerman jouni@kerman.com

Examples


  x <- rvnorm(3)
  rvquantile(x)
#>           2.5%       10%        25%          50%       75%      90%    97.5%
#> [1,] -1.999302 -1.333035 -0.7517975 -0.056468194 0.6581706 1.257175 1.925125
#> [2,] -2.069520 -1.384601 -0.7126887 -0.073716625 0.6394119 1.267052 1.885296
#> [3,] -2.038776 -1.315944 -0.6378612 -0.001008112 0.5742479 1.292131 1.922724
  rvquantile(x, probs=c(0, 0.01, 0.99, 1))
#>             0%        1%      99%     100%
#> [1,] -3.033573 -2.401861 2.307665 3.341333
#> [2,] -3.165603 -2.459759 2.119837 2.962964
#> [3,] -3.111877 -2.522209 2.256732 2.801079
  rvmedian(x)
#> [1] -0.056468194 -0.073716625 -0.001008112