QuantileFun {glmmAK} | R Documentation |
This is (almost) the same as quantile(x)
, or
apply(x, 1, quantile)
or apply(x, 2, quantile)
.
The motivation to write it was to validate my C++ function.
QuantileFun(x, probs=seq(0, 1, 0.25), vals.in.cols=TRUE)
x |
values of the function |
probs |
numeric vector of probabilities with values in [0,1] |
vals.in.cols |
if TRUE then it is assumed that function f evaluated in a specific grid point
over (MCMC) iterations is stored in a column of x . That is
(MCMC) iterations correspond to rows.
|
A data.frame
with 1 row for each probs
value.
Arnošt Komárek arnost.komarek[AT]mff.cuni.cz
probs <- c(0, 0.25, 0.354, 0.5, 0.75, 1) x <- rnorm(1001) QuantileFun(x, probs=probs) quantile(x, probs=probs) n <- 1001 xx <- data.frame(x1=rnorm(n), x2=rgamma(n, shape=1, rate=1), x3=1:n) QuantileFun(xx, probs=probs, vals.in.cols=TRUE) apply(xx, 2, quantile, probs=probs) xx2 <- t(xx) QuantileFun(xx2, probs=probs, vals.in.cols=FALSE) apply(xx2, 1, quantile, probs=probs)